If you use Salsa Labs engage / CRM and Google Analytics, you’ll probably notice that your conversion attribution is incorrect in Google Analytics. Most conversions get dumped into a self-referral. You may have tried to set up the referral exclusion list, but now all your traffic gets dumped into direct traffic.
If this is you, there is 100% a cross-domain tracking problem. This blog post is about how to address this very issue with Google Tag Manager.
Step One: What Causes A Self-referral With Salsa Labs
What causes the issue is when a user goes from one domain to another. The first domain is your non-profit domain. The second domain is your SalsaLabs.org subdomain. There are usually two cases when this happens:
- The user leaves your site domain to go to a page on your-subdomain.SalsaLabs.org.
- The user leaves your SalsaLabs.org subdomain and goes back to your main site domain.
What causes the self-referral in both cases is the Google Analytics cookie not linking up across each domain. If the cookie doesn’t link, each site assigns their own cookie which has a different clientID value.
If the clientID is different for each site is different, the following happens:
- Two separate users are recorded (one from each site)
- Two separate sessions are recorded (one for each user on each site)
Solution: tell Google Analytics that this user is actually the same across both sites.
How To Link The ClientID Across Both Domains With Google Analytics
There are two ways to link the clientId across domains with Google Analytics. They are
- Use the linker plugin from Google
- Create your own linker script
The linker plugin from Google is misleading. This is because Google says it will do the cross domain tracking for you by adding the clientID to cross domain links. That’s a partial truth - it only applies to links which are static and hardcoded in the HTML of your site. This means any time you use a form to send a user across your main site domain and your subdomain of SalsaLabs.org, the linker plugin won’t work. This is when you need to develop your own linker script.
Here are the two main cases with Salsa Labs when you will need your own linker script:
- Your main domain uses a form (or dynamic link) to send a user to your subdomain of SalsaLabs.org
- Your Salsa Labs subdomain uses a form to send a user back to your main domain
Google Analytics Cross Domain Linker Script For Salsa Labs
We developed a custom cross domain linker script for you to use with Salsa Labs. This script does the following:
- Gets the clientID from the Google Analytics cookie
- Writes the value to a hidden form field in your forms
The script we wrote works in the following cases:
- You have one Google Analytics tracker on the page
- You have only one hidden form fields in your Salsa Labs forms
If you don’t meet the cases above:
- Multiple Google Analytics trackers (EX: one for a rollup and one for your main site) - you will need to contact us for some hourly consulting to help you complete this.
- More than one hidden form field - you will need to contact us for some hourly consulting to help you complete this.
To get the script, email us.
Updating Your Salsa Labs Forms To Work With Cross Domain Tracking
After you get the script, you will need to make some configuration changes. First, you will make changes to your Salsa Labs forms. The changes are:
- Create a form field, mark it as hidden.
- Name the form gacid
- Add the hidden form field to a test form
- Check the option to pass form field values via a parameter on redirect to thank you page
Next up, you’ll need to configure Google Tag Manager
Cross Domain Tracking Setup With Google Tag Manager & Salsa Labs Forms
At this point you should have the custom linker script and you’ve set up a Salsa Labs form for a test. Now we need to set up Google Tag Manager to:
- Execute the custom linker script
- Record the clientID passed through the form with the Google Analytics pageview
Executing the custom linker script:
- Add a “Custom HTML” tag
- Name it “HTML - ThreeVentures.com - Cross Domain Linker”
- Paste the code into the tag
- Add a trigger
- Note: you should only fire this when a Salsa Labs form exists on the page.
Record the clientID passed through the form with the Google Analytics pageview
- Create a new variable
- Type: URL
- Component Type: Query
- Query Key: scf_gacid
- Name: “URL - Query - scf_gacid”
- Create a new trigger
- Type: pageview
- Some pageviews
- Referrer contains “SalsaLabs.org”
- Name: Pageview - All Referrals From Salsa Labs
- Copy your current Google Analytics pageview tag
- Rename it - “UA - Pageview - From Salsa Labs Forms”
- Select “Enable overriding settings in this tag”
- Open “more settings”
- Open “fields to set”
- Add a field
- Field name: clientId
- Value: {{URL - Query - scf_gacid}}
- Add a trigger
- Pageview - All Referrals From Salsa Labs
- Go back to your original Google Analytics pageview tag
- Add the following trigger as an exception
- Pageview - All Referrals From Salsa Labs
- Add the following trigger as an exception
- Preview
- Confirm in the debug tool that when you submit a form, that on the thank you page the following happens:
- The redirect URL contains a parameter “scf_gacid”
- The value for that parameter is written as the clientId in the tag
- UA - Pageview - Main - From Salsa Labs Forms
- Follow along in real time in Google Analytics to confirm the form submission is correctly attributed to the source you visited the site from.
- Make sure you visit the site organically, not direct, to ensure everything is working properly.
- Confirm in the debug tool that when you submit a form, that on the thank you page the following happens:
Having troubles with Google Tag Manager? Contact us for some hourly consulting help.
Wrapping Up Cross Domain Tracking With Salsa Labs Engage/CRM & Google Analytics
This post should work flawlessly for most of you. If your install is more complex, or you’re struggling, don’t hesitate to reach out. There are cases where you will need expert help. These cases are:
- If you don’t use Google Tag Manager
- You use multiple hidden form fields with your forms
- You don’t redirect the user when they submit a form
- Your tag manager container is overly complex, and or you need help
For each case about a block of hourly consulting will help address your needs. This includes a senior analytics consultant and developer support if needed. Our entire team is here to help you and your nonprofit's mission one line of analytics code at a time!