Google Web Tracking for CRM.me

Most website owners are familiar with Google Analytics that allows web admins to view statistics about traffic to their website.  CRM.me’s Google Web Tracking leverages Google analytics to capture information about registered visitors on your website and what pages they accessed.  That information is neatly packed up and can be displayed in CRM.me on the Contact record itself.

How does it work

CRM.me web forms capture the unique clientId value from visitors' Google Analytics cookie.  This is captured along with other information on the form on the Contact record created in CRM.me.  We then use the clientId to query the Google Analytics API for information about visits to the website from that individual.  

In fact the whole setup can be completed in Five easy steps:

  1. Create custom dimension in Google Analyitics account
  2. Add Google Analytics code to the pages you want to track
  3. Capture the clientId on your web forms
  4. Enter Google Web Tracking info to CRM.me
  5. Add the Google Web Tracking portlet on Contacts and Leads

The sections below cover each step in detail, but before we get stuck, lets make sure we have all of our prerequisites in place.

Prerequisites and assumptions

  • Administrative access to your website
  • Google Analytics account
  • You use Universal Analytics, Google’s improved analytics tool

Don't have a Google Analytics account yet?  You can sign up for one free here: http://www.google.com/analytics/

Tip
TIP: The steps provided here will only work for Google's Universal Analytics code (analytics.js).  If your website already uses ga.js you should create a new web property for analytics.js and dual tag your site. It is perfectly safe to include both ga.js and analytics.js snippets on the same page

Creating a Custom Dimension

From any page in your Analytics account, click Admin. Select the account and property you want to add custom dimensions to.

  1. Under property click Custom Definitions, then Custom Dimensions.
  2. Click the New Custom Dimension button.
  3. Add the name clientId.
  4. Select the Scope.
  5. Choose to track at the Hit level
  6. Check the Active box to start collecting data and see the dimension in your reports right away.
  7. Click Create.

Add Google Analytics Code to your web pages

If you have already been using Google Analytics, you will know that you will need to add a code snippet provided by Google on the pages you wish to track.  The same is true for Google Web Tracking for CRM.me, however, since we will be collecting an additional piece of information (the clientId from the visitor's google cookie) you will need to use the updated script template below.

You will need to replace the UA-XXXXXXXX-2 and example.com values with the domain and UA code that was provided to you by Google Analytics.

<script>
 (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
 (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
 m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
 })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
 
ga('create', 'UA-XXXXXXX-2', 'example.com');
 ga(function(tracker) {
 ga('send', 'pageview', {
    'dimension1' :  tracker.get('clientId')
 });
 });
</script>

This code snippet must be added to all pages you wish to track on your website.  So for example if you wanted to capture which registered visitor viewed the http://example.com/special-offers page then you would need to include this code on the special-offers page so that it loads in the visitor’s web browser.

Tip
TIP: If you load a standard header or footer on all of your web pages you can save yourself some time by adding this code there so that it loads and tracks every page.

Capturing the clientId

Now that we have added our code snippet and are recording the clientId from visitors' Google tracking cookie, we are able to see what pages on our website any individual visitor has viewed, but we still don't know the name and details of our mystery visitors.  We need to pair that clientId with a Lead or Contact in our CRM.  We will do this by reading the visitors GA cookie and passing the clientId as a hidden field on our lead capture form(s).

So for example, if John Smith completes our Contact us form providing his contact details we also pass his clientId, extracted from his GA cookie to CRM.me at the same time.  Now CRM.me can query our Google Analytics account to extract information about pages John has been visiting on our website.  So how do we capture the clientId?

I use CRM.me web forms

If you are using CRM.me web forms on your website to capture new leads then it is real easy. In fact you don't need to do anything, we have done the work for you.   Whether you use Google Web Tracking or not all web forms created in CRM.me will look for and pass the GA clientId as a hidden field on form submissions.  So if you are setting this up and already use CRM.me web forms then you are already done and can move on to the next step!  :)

Enter Google Web Tracking info to CRM.me

Assuming that you have completed all of the steps above for your website, you can now open CRM.me to complete the configuration.  We need to give CRM.me information about our Google Analytics account so that it can access the account and pull the information it needs.  To do this just follow the steps below:

  1. Click on the Gear and select Administration
  2. Click Plugins and then Google Web Tracking
  3. Enter Email Address: this is the email address you use to access your Google Analytics account
  4. Enter Password: this is the password of the account above for access to Google Analytics
  5. Enter Profile Id: this is the profile ID of your Google Analytics account. You can obtain this from within Google Analytics, if you are not sure how then take a look at this. https://kb.paessler.com/en/topic/35363-where-do-i-find-my-google-analytics-profile-id
  6. To use this feature you need to enable Access for less secure apps in your account.

Add the Google Web Tracking portlet on Contacts and Leads

In order to see the data captured by Google Web Tracking you will want to add the Google Web Tracking portlet on Contacts and Leads.

  1. Open any contact record and click on the padlock icon in the top right to make the layout editable.  
  2. Click on the Add Portlet button that appears
  3. A list of add-able Portlets appear, click on the Add Portlet button next to Google Web Tracker to add that portlet.
  4. Position the portlet to where you want it to appear on the screen.  Once done click the padlock icon again to secure the layout.

Tips and FAQs

Got some nagging questions? Scratching your head? Maybe you are just really excited and want to know more. Whatever your reason here are some tasty tips and FAQs to take a look at.

Q. What is a registered visitor?

A. A registered visitor is someone who has completed a CRM.me web form on your website. When this happens CRM.me captures contact information about the visitor and the clientId from their GA cookie so you can tie the two together.  Google analytics will still track activity about other visitors, but CRM.me has no personal details for these individuals as these are unregistered visitors.

Q. I just viewed the website as a registered user but nothing has appeared in the portlet yet?

A. Don't worry if you don't see activity appear on the portlet right away. Information collected from Google Analytics can take from 12 to 24 hours to appear before it is retrieved by CRM.me.

Q. What happens if someone deletes their cookies?

A. If a registered visitor deletes their cookies then CRM.me will no longer be able to track when they come to your website.  You would have to wait for them to complete another web form so that you can read their new clientId from their new GA cookie.

Q. Why else might information not show in the portlet?

A. The GA cookie is stored locally on visitors machines and is browser based.  If I connect to a website from Internet Explorer and later access the same website using Chrome then Google Analytics considers this as 2 different visitors, the same is true if I use a different device.  Therefore CRM.me will only recognize a registered user if they return to your website using the same machine and browser that they used to fill in the web form that captured their data.

Q. Don’t GA cookies expire?

A. There are a number of different GA cookies. The one we specifically look at expires after 2 years and its expiry date is reset each time the user visits your site before the expiration of the cookie.

Q. I used the code snippet in the article and now all my Google tracking data has stopped?

A. If you you are currently using the old Google Analytics code then you cannot simply start using the new analytics.js code included in the article by updating the UA and domain values.  You will first have to upgrade your GA Property so that it can use the new Universal Analytics engine.  This Google article will run you through the process:  https://developers.google.com/analytics/devguides/collection/upgrade/guide

Alternatively, if you wish, you can create a new Property in GA that will use Universal Analytics and add the new code snippet to your web pages.  It is perfectly safe to include both ga.js and analytics.js snippets on the same page.  This Guide will walk you through the process of creating a new Property in GA:  https://support.google.com/analytics/answer/1042508?hl=en

Q. Will I see tracking for all of the Contacts I have in CRM.me?

A. Google Web Tracking for CRM.me will only display information for contacts that have a clientId recorded on their record in the crm DB.  Only contacts captured via a webform after the set up of Google Web Tracking for CRM.me will have their ClientId recorded on their contact record.  All other contacts, whether they were already in your system or are added later via a method other than a webform will not have a clientId and will not be tracked.

Can’t find the answer to your question?  Why not contact the CRM.me support team to see if they can help: support@CRM.me.

Have more questions? Submit a request

Comments

Powered by Zendesk