What is a Google Analytics Client ID?
A Google Analytics Client ID is a unique identifier that is assigned by Google Analytics to a user when they first visit your website or app.
The Client ID is stored in a user’s browser via cookies so user sessions and interactions across multiple sessions are tracked and retained for the duration of the cookie’s lifespan.
You can usually find the Client ID stored in the _ga cookie:
- The first part, 94226024, is a randomly generated number assigned to the user
- The second part is a timestamp indicating when the ID was created in unix format.
Why should you send the Google Analytics client ID to your CRM?
By enriching your CRM data with the Google Analytics ID, you can discover how leads find you and what they see before buying. This also provides other key advantages such as:
- Identify which website sessions / activity belong to a known customer or lead.
Attribute anonymous browsing behavior (e.g., pages visited, products viewed) to a CRM contact/lead once they submit a form or log in. - Better Reporting and Segmentation
By default, Google Analytics doesn’t track offline revenue. Sales are often closed by sales reps and only tracked in Salesforce or some other CRM software. Having the client ID data allows you to create combined reports and merge online behavior with offline data. - Personalization and Retargeting
By combining Client ID with your CRM data, you can use the data to create highly personalized retargeting campaigns based on website behavior.
Sending the Google Analytics Client ID with your CRM allows opportunities for enhanced insights, improved personalization, and more effective decision-making.
This also allows you to answer questions like:
- How many of your website visitors actually became paying customers.
- Which campaigns, ads, blog posts and keywords drive the most qualified leads?
- Which traffic sources only drive junk traffic that distracts your sales reps from valuable customers that your company can actually help?
Retrieving the Client ID and sending it to your CRM
There are a lot of ways to send the client ID to your CRM. Today, we’re going to show the most common method for most CRMs which is through a lead generation form.
Setup your form
- Start by creating a new hidden input field on your form.
- Set the ID of the new input field to “ga_client_id”
- Note: Make sure that this new hidden field is properly mapped to your CRM to make sure that when the form is submitted, the values are stored in your CRM.
Getting the Client ID
You can retrieve the GA4 Client ID programmatically using the gtag.js library, or even directly from the cookies. Add this script after your form.
If using gtag.js
1 2 3 4 5 |
<script> gtag('get', 'G-XXXXXX', 'client_id', (clientID) => { document.querySelector("#ga_client_id").value = clientID; }); </script> |
If you are using Google Tag Manager, you can get it directly from the cookies
1 2 3 4 5 6 7 8 9 10 |
<script> var cookie = {}; document.cookie.split(';').forEach(function(el) { var splitCookie = el.split('='); var key = splitCookie[0].trim(); var value = splitCookie[1]; cookie[key] = value; }); document.querySelector("#ga_client_id").value = cookie["_ga"].substring(6); </script> |
The easy method and taking it to the next level
Depending on your CRM, lead generation form, or even how your website is built, saving the Client ID to your CRM isn’t always straightforward.
Another easy method is to use GA Connector.
GA Connector works with most CRMs such as Salesforce, Pipedrive, Zoho CRM and HubSpot. If you don’t have time to set up the integration yourself, our support team can always help.
Aside from retrieving and sending the client ID, GA Connector can also track and send the following information to your CRM:
Start Your Free Trial Now!
30 Days – No credit card required