Site icon iDimension

Using the fragment portion of the URL to pass campaign parameters

If the anchor portion of the URL contains Google Analytics custom campaign parameters (i.e., UTM parameters), those parameters get kept in the anchor and sent to Google Analytics for processing, unless the allowAnchor field is set to false (reference this Google Developers help page.)

This is a change related only to the most recent version of Google Analytics tracking code (i.e., analytics.js).  However, this practice it still not recommended (e.g., per the Google Analytics “Campaign URL Builder” page) for several reasons:

  1. URL fragments in ad destination URLs are not supported by some advertising platforms.  In some cases the URL fragments can be stripped before sending the user to the landing page URL, which means they would not be present in the landing page for processing by Google Analytics.
  2. If the most recent version of Google Analytics tracking code (i.e., analytics.js) is not inline in the landing page, the parameters won’t be sent to the related page’s Google Analytics property for processing.
  3. Single-page applications, as well as AJAX methods, reserve the hashtag for specific purposes.   It’s not a good idea to potentially interfere with those purposes by using the fragment portion of the URL to pass campaign parameters.
  4. Google Analytics recently started to include the fragment in the Request URI dimension by default, which can add a good bit of “noise” to all Google Analytics reports that present this dimension.

The fragment portion of the URL starts with an anchor tag, also known as a hashtag (e.g., “#user-id-feature” in URL https://www.idimension.com/multi-channel-funnels/#user-id-feature).  Historically, URL fragments have been used to automatically set the browser’s scroll position to a predefined location in the web page.  URLs refer to a document, and the fragment refers to a specific subsection of that document.

As noted, the hashtag can have more advanced programmatic meaning for single-page applications & AJAX methods in general.  Google previously required special coding to make AJAX applications crawlable.  However, this AJAX crawling scheme was officially deprecated in October 2015.  Today, as long as you’re not blocking Googlebot from crawling your JavaScript or CSS files, Google is  generally able to render and understand your web pages like modern browsers. To reflect this improvement, Google recently updated their technical Webmaster Guidelines to recommend against disallowing Googlebot from crawling your site’s CSS or JS files.

Using the fragment portion of the URL to pass campaign parameters
Exit mobile version