Installing the Tracking Snippet

SegMetrics comes with its own Tracking Snippet that collects advanced metrics on your leads, including their real lead source, optin URL, UTM codes from when they first hit your site, geo-location and much, much more.


Installing the Snippet

  1. Go to your Site Setup page from the gear in the top menu
  2. Copy the snippet code and put it on every page of your website, right before the closing </body> tag.
    You should include this code even on pages where you don't have any optin forms, so that we can accurately track your lead sources.
  3. You can also install the snippet using Google Tag Manger or other script-manager.

Available Options

There are a number of options available for the Tracking Snippet, depending on your use case. All of these options are on a per-page basis, so you can mix-and-match depending on the needs of each of the pages. In order to enable these options, turn on the "Snippet Option" and the copy/paste that code onto the specific page.

Populate UTM fields on your existing forms Enable this option to add the UTM fields to any forms on the page. This will allow the UTM values to be saved in Infusionsoft in addition to SegMetrics. In order to enable this, you will need to  set up your Custom Fields.
Track forms in iFrames Due to browser security issues, it is not possible to track inputted emails and form submissions through iFrames. After enabling this option, make sure that the SegMetrics snippet is installed on both the main page AND the iFrame page to ensure correct tracking.
Track users across multiple root domains Due to privacy concerns, cookies are not shared between different root domains (example.com and example-site.com would be an example). Turning this option on will use a third-party cookie to track users across multiple domains that you own. Please note that third-party cookies may be blocked by default on some browsers, so if you don't absolutely need it, we recommend leaving this feature unchecked.

How the Tracking Snippet Works

The tracking snippet currently tracks two different values as users visit your site: the optin values, and the journey values.

Optin Values

Optin Values are the UTM values, URL and Referring Domain that a lead first visits your site with, and are added to the contact record the FIRST time the contact record is created.

These values will not be updated, and function as a "where did this lead come from" report in SegMetrics.

Journey Values

Journey Values track visitors and leads through the entire user experience, whether they've joined your list or not. Once the visitor joins your list, we connect that historical data (up to 60 days) with the contact to create a complete journey path.

Here is how we track and calculate Journey Values:

  • When a visitor comes to your site, they are given a unique ID.
  • Any URL that has a UTM value, ad_id, contactId, ContactId, contact_id, c, cid or email in the query string will be tracked as a click. This includes email clicks, ad clicks and site clicks.
  • Any URL that has a cid, contactId or email in the query string will call an identify call, which connects the current unique ID to the contact record. This enables us to track contacts across multiple devices.
  • Any time a contact fills out a field with a valid email address, we will call an identify call, which will connect the current unique ID to the contact record.
  • The latest tracked click before the contact was created is considered the First Optin action. (There will only be one First Optin)
  • The latest tracked click before an optin (up to 60 minutes) is considered the Optin action. (There can be multiple Optins through a contact's lifetime)
  • The latest tracked click before a purchase (up to 60 minutes) is considered the Purchase action.

Recommendation: Add cid to all email links

Depending on your CRM Integration, you'll want to use either the cid (contact id) or email values to track users:

  • Infusionsoft - http://example.com/?cid=~Contact.Id~
  • ActiveCampaign - http://example.com/?cid=%CONTACTID%
  • Ontraport - http://example.com/?email=[Email]
  • Drip - (done automatically! No need for a setting)
  • HubSpot - http://example.com/?cid=~{{contact.id}}
  • ConvertKit - http://example.com/?cid=~{{subscriber.id}}
  • Klaviyo - http://example.com/?email={{ email }}
  • MailChimp - http://example.com/?cid=*|UNIQID|*

Still need help? Contact Us Contact Us