Troubleshooting
Testing SourceTag
After installing SourceTag, follow these steps to confirm everything is working. You’ll check four things: the script is loading, the cookie is being set, hidden fields are being populated, and form submissions contain the data.
Step 1: Verify the script is loading
Visit your site and open the browser developer tools (F12 or Cmd+Option+I on Mac).
Check the page source
Go to the Elements panel and search for SourceTag (Ctrl+F or Cmd+F in the Elements panel). You should find a script tag like:
<script src="https://cdn.sourcetag.io/scripts/YOUR_SITE_ID/st.js" async></script> [IMAGE: Screenshot of browser developer tools Elements panel with the SourceTag script tag highlighted]
Check the Network panel
Open the Network panel, reload the page, and filter by st.js. You should see the script file loaded with a 200 status code.
If you see a 404 or no request at all:
- Double-check that you’ve pasted the script tag correctly
- Make sure you’ve clicked Generate Script in the SourceTag dashboard (the script file isn’t created until you generate it)
- Check that the Site ID in the script URL matches your site in the dashboard
[IMAGE: Screenshot of browser developer tools Network panel showing st.js loaded with 200 status]
Step 2: Check the cookie
Visit your site with UTM parameters in the URL:
https://yoursite.com/?utm_source=test&utm_medium=cpc&utm_campaign=testing-SourceTag In developer tools, go to Application > Cookies (Chrome) or Storage > Cookies (Firefox). Look for a cookie named _sourcetag on your domain.
[IMAGE: Screenshot of browser developer tools Application panel showing the _sourcetag cookie]
Click on the cookie to inspect its value. You should see a JSON string containing fc and lc objects with your test UTM values. The fc.channel should show the matched channel (e.g. “Paid Search” if you used utm_medium=cpc), and fc.d1 should show the source value.
The channel will depend on your configured channel rules. With utm_medium=cpc, it would typically match Paid Search.
Using the console
You can also check the data via the JavaScript API. Open the Console panel and run:
// Check if the API is available
console.log(window.__sourcetag);
// Get first contact data
console.log(window.__sourcetag.getFC());
// Get last contact data
console.log(window.__sourcetag.getLC());
// Check visit count
console.log(window.__sourcetag.getVisits());
// Check days to convert
console.log(window.__sourcetag.getDaysToConvert()); [IMAGE: Screenshot of browser console showing window.__sourcetag output with test data]
Step 3: Check hidden fields before submitting
Navigate to a page with a form on it (keeping the same browser session so the cookie persists). In the developer tools Elements panel, find the <form> element and expand it.
You should see hidden input fields that SourceTag has added:
<input type="hidden" name="st_fc_channel" value="Paid Search">
<input type="hidden" name="st_fc_detail_1" value="test">
<input type="hidden" name="st_lc_channel" value="Paid Search">
... [IMAGE: Screenshot of browser developer tools Elements panel showing hidden input fields inside a form with SourceTag values]
If the hidden fields aren’t there:
- Make sure the script has loaded (Step 1)
- Check that the form is a standard
<form>HTML element - If the form loads dynamically (e.g. in a popup), it may take a moment for MutationObserver to detect it. Try opening the popup and then inspecting.
Step 4: Submit a test form
Fill in the form with test data and submit it. Then check wherever the form data ends up:
- Email notifications: Check the form notification email. Attribution fields should be listed alongside the regular form fields.
- CRM: If your form pushes data to a CRM (HubSpot, Salesforce, etc.), check the new contact record for the SourceTag custom fields.
- Form builder submissions: If using a form builder (Gravity Forms, WPForms, etc.), check the submissions list in the form builder’s admin.
You should see values like:
| Field | Value |
|---|---|
| st_fc_channel | Paid Search |
| st_fc_detail_1 | test |
| st_fc_detail_2 | testing-SourceTag |
| st_fc_detail_3 | (not set) |
| st_fc_detail_4 | (not set) |
| st_lc_channel | Paid Search |
| st_lc_detail_1 | test |
| st_lc_detail_2 | testing-SourceTag |
| st_fc_landing_page | /?utm_source=test&utm_medium=cpc&utm_campaign=testing-SourceTag |
| st_lc_landing_page | /?utm_source=test&utm_medium=cpc&utm_campaign=testing-SourceTag |
Fields that have no value (e.g. st_fc_detail_3 when no utm_term was provided) show (not set) rather than being left blank. This is expected.
[IMAGE: Screenshot of a form submission notification email showing SourceTag attribution fields]
Testing different channels
To test various channel categorisations, visit your site with different URL parameters:
| Channel to test | URL to use |
|---|---|
| Paid Search | ?utm_source=google&utm_medium=cpc&utm_campaign=test |
| Paid Social | ?utm_source=facebook&utm_medium=cpc&utm_campaign=test |
?utm_source=mailchimp&utm_medium=email&utm_campaign=test | |
| Display | ?utm_source=google&utm_medium=display&utm_campaign=test |
| Direct | Visit the bare URL with no parameters and no referrer (open a new incognito window and type the URL directly) |
For Organic Search and Organic Social, you’d need to actually arrive via a search engine or social network, as these are detected by referrer rather than UTM parameters.
Testing first contact vs last contact
- Open an incognito/private browsing window (to start with a clean cookie)
- Visit with UTMs:
?utm_source=google&utm_medium=cpc&utm_campaign=first-visit - Check the cookie. Both
fcandlcshould show Paid Search / google. - Wait a moment, then visit again with different UTMs:
?utm_source=facebook&utm_medium=cpc&utm_campaign=second-visit - Check the cookie again.
fcshould still show google/first-visit.lcshould now show facebook/second-visit.
Troubleshooting test failures
If something isn’t working, see Troubleshooting for common issues and fixes.