Skip to content

Commit b3d5603

Browse files
Merge pull request #4279 from segmentio/vanand17-patch-8
Add UTM Tracking information for AJS
2 parents 8fc0bbc + 7b17471 commit b3d5603

File tree

1 file changed

+19
-0
lines changed
  • src/connections/sources/catalog/libraries/website/javascript

1 file changed

+19
-0
lines changed

src/connections/sources/catalog/libraries/website/javascript/index.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -760,6 +760,25 @@ Analytics.js tracks across subdomains out of the box; all Segment destinations f
760760

761761
To track activity on your subdomains, include the Segment Analytics.js snippet on each subdomain. Segment sets users' `anonymousId` on the top-level domain, so users are tracked across any subdomains.
762762

763+
## UTM Tracking
764+
765+
UTM parameters are only used when linking to your site from outside your domain. When a visitor arrives using a link containing UTM parameters, Segment's analytics.js library will parse the URL query string and add the information to the event payload. For more information about UTM tracking, see the [Tracking Customers Across Channels and Devices](/docs/guides/how-to-guides/cross-channel-tracking/) documentation.
766+
767+
UTM parameters contain three essential components (utm_source, utm_medium, utm_campaign) and two optional (utm_content, utm_term). For example, if you include the following three parameters in your URL: ?utm_source=mysource&utm_medium=email&utm_campaign=mytestcampaign, once a visitor arrives using a link containing the above, Segment automatically grabs the UTM parameters and subsequent events will contain these parameters within the 'context' object (visible in the raw view of your Source Debugger.)
768+
769+
So, for example, if somebody follows the link with above query string to your site, the subsequent 'page' call in your Debugger should contain the below and will be passed to any enabled destinations:
770+
771+
772+
"context": {
773+
"campaign": {
774+
"medium": "email",
775+
"name": "mytestcampaign",
776+
"source": "mysource",
777+
},
778+
779+
780+
Whenever the UTM parameters are no longer a part of the URL, Segment no longer includes them. For example, if the user goes to a new page within your website which does not contain these parameters, they will not be included in subsequent events. UTM parameters are non-persistent by default as they could potentially cause data accuracy problems. Here's an example of why: Say a user clicks on an ad and lands on your site. He navigates around and bookmarks an internal page - or maybe shares a link with a friend, who shares it with another friend. All those links would then point back to the same test utm_source as the initial referrer for any purchase.
781+
763782
## Analytics.js performance
764783

765784
The Analytics.js library and all Destination libraries are loaded with the [HTML script `async` tag](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#attr-async){:target="_blank"}. This also means that Segment fires methods asynchronously, so you should adjust your code accordingly if you require that events be sent from the browser in a specific order.

0 commit comments

Comments
 (0)