ÃÛ¶¹ÊÓƵ

referrer

The referrer variable overrides the automatically collected referrer in reports. This variable is helpful in situations where the referrer might be lost, such as during redirects or temporarily forwarding the visitor to a payment processor. This variable helps populate the ‘Referrer’ and ‘Referring Domain’ dimensions.

Referrer using the Web SDK

Referrer is mapped to the following variables:

The Web SDK automatically includes web.webReferrer.URL on every event sent, if available.

Referrer using the ÃÛ¶¹ÊÓƵ Analytics extension

You can set referrer either while configuring the Analytics extension (global variables) or under rules.

  1. Log in to using your ÃÛ¶¹ÊÓƵID credentials.
  2. Click the desired tag property.
  3. Go to the Rules tab, then click the desired rule (or create a rule).
  4. Under Actions, click an existing ÃÛ¶¹ÊÓƵ Analytics - Set Variables action or click the ‘+’ icon.
  5. Set the Extension drop-down list to ÃÛ¶¹ÊÓƵ Analytics, and the Action Type to Set Variables.
  6. Locate the Referrer section.

You can set referrer to any string value, including data elements.

s.referrer in AppMeasurement and the Analytics extension custom code editor

The s.referrer variable is a string containing the URL of the previous page. This variable can store a maximum of 255 bytes; values larger than 255 bytes are truncated. AppMeasurement automatically sets this variable to document.referrer; you do not need to set this variable unless you want to override the automatically collected value.

s.referrer = "https://example.com";

If using the digitalData data layer:

s.referrer = digitalData.page.pageInfo.referringURL;
CAUTION
Avoid setting this variable to non-URL values. Do not strip the URL’s protocol.

Example

Many organizations deal with implementations around redirects. You can use the Util.getQueryParam() utility to obtain referrer from the URL if your site accommodates it. Make sure that you URL encode any values included in the query string.

// Example if the URL is https://example.com?r=https%3A%2F%2Fexample.org
s.referrer = s.Util.getQueryParam("r");
recommendation-more-help
b4f6d761-4a8b-4322-b801-c85b9e3be690