Google Analytics Settings Screenshot

How to Attribute Traffic from SalesLoft (Because Reps Def Aren’t Using UTMs)

Sponge is pretty obsessed with putting UTMs on f*cking everything.  But what happens when you have inbound traffic from links you can’t control?  Here’s how we re-write parameters on the fly, in this case for SalesLoft emails (because no Sales rep or BDR is going to use the UTM spreadsheet).

>> Related: How to Implement a Marketing Attribution Model <<

Attribute Traffic from SalesLoft

We recently worked with a client who wanted to attribute any/all traffic coming from SalesLoft in Google Analytics.  Thankfully SalesLoft always appends a sbrc parameter to links in SalesLoft emails when Live Website Tracking is enabled for the domain of the destination URL. So,

  1. In Google Tag Manager, I created a custom variable to check if the parameter sbrc is present in the query string.
  2. If so, before we send our hit to Google Analytics, we’re going to set or override some UTM parameters before hitting Google Analytics servers. In essence, we’re saying, “I know this visit is from SalesLoft, therefore modify the utm_medium and utm_source to email and salesloft, respectively.”
  3. Voila! As far as Google Analytics is concerned, that’s the actual URL that somebody hits.

IMPORTANT: for this to work, you must deploy Google Analytics through Google Tag Manager.

Step-by-Step

  1. Create a new custom variable called sbrc. For the variable type, select URL. Under Component Type, choose Query. For Query Key, type sbrc. This will set the variable equal to the value of the sbrc query string parameter.
  2. Create another custom variable called utm_medium using the same values as above, except this time, set Query Key = utm_medium.
  3. Repeat the previous step for utm_source, utm_campaign, utm_term, and utm_content.
  4. Next, we’ll create a new custom variable of type Custom Javascript called utm_medium Modified. Copy and paste the following:
    function(){
    	var medium = {{utm_medium}};
    	if ({{sbrc}}) {
    	  medium = "email";  
    	}
    	return medium;
    }
    

    This code checks to see if the custom variable sbrc that we defined in Step 1 has a value. If so, it sets the value of utm_medium Modified equal to “email” (because we know this traffic is from SalesLoft), otherwise, the value will be equal to the original utm_medium value. Most likely, this is probably null, but we would override any value that may have been set.

  5. Create another Custom Javascript variable called utm_source Modified and copy and paste the following code:
    function(){
    	var source = {{utm_source}};
    	if ({{sbrc}}) {
    	  source = "salesloft";  
    	}
    	return source;
    }
    
  6. In your Google Analytics tag, select your Google Analytics Settings variable, and add the following Fields to Set: Google Analytics Variable Configuration Settings ScreenshotHere, we’re setting the values for campaignMedium, campaignSource, campaignName, campaignContent, and campaignKeyword equal to our custom variables utm_medium Modified, utm_source Modified, utm_campaign, utm_content, and utm_term, respectively.
  7. Save and publish your Google Tag Manager version, and start seeing SalesLoft traffic categorized appropriately in Analytics!

Notes:

  • You must add subdomains as separate domains when configuring your Live Website Tracking in SalesLoft as they treat example.com and www.example.com as separate domains. Make sure you add any and all subdomains you want tracked to this list.
  • This will only apply to traffic going forward and will NOT update historical traffic retroactively.

 

Want tips, tutorials, best practices, and other cool stuff delivered to your inbox every month?  Subscribe to the Sponge newsletter >

Sponge | Marketing and Operations Analysts

Get a System Audit

Whether you inherited a new instance or just want a second opinion, we'll dive in and benchmark your tech stack.

Sponge | Marketing and Operations Analysts

Download Resource

Use this form to recieve your free resource in your inbox today!