While Amplitude’s TypeScript Browser SDK does not collect web attribution data by default, setting it up is simple. The SDK can automatically collect this information if certain attribution configuration options are enabled.
Amplitude supports automatically tracking the following through the SDK configuration options:
- The 5 standard UTM parameters from the user's browser cookie or URL parameters by using includeUtm.
- The referring URL and domain from includeReferrer.
- Google Click Identifier from URL parameters through includeGclid.
- Facebook Click Identifier from URL parameters through includeFbclid.
UTM parameters stand for Urchin Traffic Monitor parameters and are useful for analyzing the effectiveness of different ad campaigns and referring sites. Note that UTM parameters are case sensitive so they will turn out to be different values if the capitalization varies.
There are five different standard UTM parameters:
- utm_source: This identifies which website sent the traffic (e.g. Google, Facebook).
- utm_medium: This identifies what type of link was used (e.g. banner, button, email).
- utm_campaign: This identifies a specific campaign used (e.g. summer_sale).
- utm_term: This identifies paid search terms used (e.g. product+analytics).
- utm_content: This identifies what brought the user to the site and is commonly used for A/B testing (e.g. bannerlink, textlink).
Here is an example URL:
In Amplitude, once you set the
includeUtm option to true, the SDK will automatically pull UTM parameters from the referring URL and include them as user properties on all of the relevant events:
includeGclid: Gclid (Google Click Identifier) is a globally unique tracking parameter used by Google. If utilized, Google will append a unique parameter (e.g. "?gclid=734fsdf3") to URLs at runtime. By setting this to true, the SDK will capture
gclidas user properties.
includeFbclid: Fbclid (Facebook Click Identifier) is a globally unique tracking parameter used by Facebook. If utilized, Facebook will append a unique parameter (e.g. "?fbclid=392foih3") to URLs at runtime. By setting this to true, the SDK will capture
fbclidas user properties.
includeUtm: If true, finds the standard UTM parameters from either the URL or the browser cookie and sets them as user properties. This will set
utm_contentas well as
initial_utm_contentas user properties for the user.
Those UTM parameters will be set as user properties which will persist for all of the user's events going forward. However, initial UTM parameters are captured only once for each user via a setOnce operation.
If you want to track how users are getting to your website, then all you need to do is track the referrer (the referring site).
Here are the fields Amplitude supports tracking automatically:
- referrer: The last page the user was on (e.g. https://amplitude.com/behavioral-analytics-platform?ref=nav).
- referring_domain: The domain that the user was last on (e.g. amplitude.com).
Once you set the
includeReferrer option to
true, Amplitude will capture the referrer and
referring_domain for each session and set them as user properties on all of the relevant events:
- includeReferrer: If true, captures the
referrer and referring_domain for each session as user properties as well as theinitial_referrer
user properties once for each user. The referrer is the entire URL while thereferring_domain` is only the domain name from where the user came from.
Initial referring information is captured only once for each user via a setOnce operation.
Amplitude can capture the initial UTM parameters and referrer information for each user. The first-touch attribution values are set when a user's non-null UTM parameters are seen for the first time. The following user properties are set once:
This is done by setting the TypeScript Browser SDK configuration options
Note: Initial attribution information for users can change if there are merged users.
In addition to first-touch attribution, Amplitude will capture where a user came from for each of their sessions. This is accomplished by setting the following user properties:
This is done by setting the SDK configuration options
includeFbclid to true.
Updated 19 days ago