Example: Browsing Without Redirects
Consider the following hypothetical scenario in which the user does not encounter a redirect:
- User points his or her browser to
www.google.com
, and types, “discount airline tickets” into the search field, and then clicks the Search button. - The browser displays the search results including a link to your site, https://www.example.com/. After displaying the search results, the browser’s address bar displays the search terms that the user entered in the search field (
https://www.google.com/search?hl=en&ie=UTF-8&q=discount+airline+tickets
). Notice that the search terms are included in the URL query string parameters that followhttps://www.google.com/search?
. - The user clicks the link to your hypothetical site https://www.example.com/. When the user clicks this link and lands on the example.com website, Analytics uses JavaScript to collect the referring URL (
https://www.google.com/search?hl=en&ie=UTF-8&q=discount+airline+tickets
) as well as the current URL (https://www.example.com/
). - Analytics reports the information collected during this interaction in various reports, such as Referring Domains, Search Engines, and Search Keywords.
Example: Browsing With Redirects
Redirects can cause the browser to blank out the true referring URL. Consider the following scenario:
- User points his or her browser to
https://www.google.com
, and types, discount airline tickets into the search field, and then clicks the Search button. - The browser window’s address bar displays the search terms that the user typed into the search field
https://www.google.com/search?hl=en&ie=UTF-8&q=discount+airline+tickets
. Notice that the search terms are included in the URL query string parameters that followhttps://www.google.com/search?
. The browser also displays a page that contains the search results including a link to one of your domain names: https://www.flytohawaiiforfree.com/. This vanity domain is configured to redirect the user tohttps://www.example.com/
. - The user clicks on the link
https://www.flytohawaiiforfree.com/
and is redirected by the server to your main site,https://www.example.com
. When the redirection occurs, the data that is important to Analytics data collection is lost because the browser clears the referring URL. Thus, the original search information used in the Analytics reports (for example, Referring Domains, Search Engines, Search Keywords) is lost.
Implement redirects
In order to capture Analytics data from redirects, four minor alterations need to be made to the code that creates the redirect and the AppMeasurement for JavaScript file.
Completing the following steps will retain the information that the original referrer (for example, https://www.google.com/search?hl=en&ie=UTF-8&q=discount+airline+tickets
in the scenario above) passes to your site:
Configure referrer override JavaScript code
The code snippet below shows two JavaScript variables, s_referrer
and s_pageURL
. This code is placed on the ultimate landing page of the redirect.
s.referrer
only once on the page. Setting it more than once with every tracking call or with every link click that is tracked causes double counting of the referrer and related dimensions, such as search engines and keywords.Redirects using getQueryParam
While the getQueryParam is an easy way to populate Analytics variables with query string values, it must be implemented in connection with a temporary variable so that legitimate referrers are not overwritten when the query string is empty. The best way to use getQueryParam is in connection with the getValue plug in as outlined with the following pseudo-code.
Modify the redirect mechanism
Because the browser strips referring URL, you must configure the mechanism that handles the redirect (for example, the web server, server-side code, client-side code) to pass along the original referrer information. If you would also like to record the alias link URL, this must also be passed along to the ultimate landing page. Use the s_pageURL
variable to override the current URL.
Because there are many ways to implement a redirect, you should check with your web operations group or your online advertising partner to identify the specific mechanisms that execute redirects on your website.
Capture the original referrer
Normally, Analytics will obtain the referring URL from the browser’s document.referrer property, and the current URL from the document.location property. By passing values to the referrer
and pageURL
variables, you can override the default processing. By passing a value to the referrer variable, you are telling Analytics to ignore the referrer information in the document.referrer property and to use an alternative value that you define.
Therefore, the final version of the landing page would need to contain the following code to correct the issues introduced in the “discount airline tickets” scenario.
Verify the referrer with the Adobe Debugger
Run a test to verify that the referrer, originating URL ( s_server
) and campaign variables are being captured.
These variables will be represented as the following parameters in the Experience Cloud Debugger.
URL or Query String Value | Value as Shown in the DigitalPulse Debugger | |
---|---|---|
Original Referrer | https://www.google.com/search%3F hl%3Den %26ie%3DUTF826q%3 Ddiscount%2Bairline%2Btickets | r=https:/ref=www.google.com/search?hl=en&ie=UTF -8&q=discount+airline+tickets |
Page URL | https://www.flytohawaiiforfree.com |
g=https://www.flytohawaiiforfree.com This value will appear in the DigitalPulse Debugger if the pageURL variable is used. |
Ultimate Landing Page URL | https://www.example.com | This value will NOT appear in the DigitalPulse Debugger if the pageURL variable is used. |
The text that the debugger displays should correspond to the following example:
After verifying that the Adobe Debugger displays these variables, it is always helpful to confirm that the search terms and the original referring domain (prior to the redirect) are registering traffic in reports.
More help on this topic
Analytics
- Analytics tech notes
- Adobe Analytics for Google Analytics users
- Analyze data impacted by events
- Client hints
- Cookies
- Data retention
- Domains
- Exclude data
- IP addresses
- Latency
- Low-traffic value
- Migrate Mobile Services processing rules to Adobe Analytics
- Multi-currency support
- Privacy overview
- Processing order
- Progressive web apps
- Redirects and aliases
- Security resources
- Terms used (glossary)
- Timestamps Optional
- Troubleshoot logging in
- Troubleshoot getting logged out
- Unspecified, other, and unknown
- Visitor migration
- VISTA rules
Data Drip: Benefits of migrating from an old system to WebSDK
Data Drip
Thursday, Apr 10, 4:00 PM UTC
Join us as Adobe Technical Advisor, Arindam Agarwal, guides us through the benefits of implementing Adobe WebSDK. Arindam will provide an in-depth overview and answer questions live during the Q&A. Register today!
RegisterAdobe Analytics at Summit
Register for these sessions:
- Adobe’s New Tools: Empowering Third-Party Developers (attend online)
- Adobe Analytics: Using Advanced Metrics to Level Up Your Reporting (attend online)
- Elevate and Empower Teams with Agentic AI for Exceptional Experiences (attend online)
- How EY Enhanced Regulatory Knowledge Management with Adobe Solutions (attend online)
- Put the Customer at the Center and Build Relationships That Last a Lifetime (attend online)
Connect with Experience League at Summit!
Get front-row access to top sessions, hands-on activities, and networking—wherever you are!
Learn more