Log Date

Analytics manager using data to make digital content more effective.

  1. March 24, 2013

    Text post

    How to retain visitors during a Domain move


    In the IT department, we often ask the question “when is it appropriate to retire a domain redirect?” Our objective is to update backlinks, retain search rankings and encourage direct visitors to update bookmarks. We achieve this by tracking visits from redirected domains and URLs.

    With hundreds of publicly accessible domains, universities constantly deal with site churn where domains are moved, new domains are added, old ones deprecated and some are simply lost in the shuffle.

    Avoiding arbitrary redirect sunsets

    My organization sets a 6 month expiry on domains as a matter of policy. Some clients might quip that this time frame is arbitrary. However, it is a blanket decision made in a vacuum rather than one that is informed by usage data.

    On one hand, the domain could be heavily used to draw inbound visits, in which case we do a disservice to the original domain’s visitors. On the other hand, this policy reduces overhead. 6 months is also ample time for search engines like Google and Bing to pass search engine authority from the old URL to the new URL, assuming 301 HTTP headers are used in the redirects.

    Updating backlinks

    We are unable to adequately prioritize limited resources to address outdated backlinks. That is due - in part - to site owners that are unable to invest in link building. We lack collection capabilities on what university Web pages (from a domain other than the site in question) and external Web pages continue to reference the outdated domain or link. We look at our enterprise search appliance for hints of existing links that needed updating, and used search engines like Google to find other referring links. If analytics tracking code was installed on the old site prior to a move, we could pull a list of referrals sorted by visits. Any list we returned was far from complete. The lists also lacked a key metric, visits from a referral source to the new site. If there were dozens or hundreds of links to the content, which ones should we spend time addressing? Despite efforts to notify owners of backlinks, how many are still linking to the old URL? We lacked visibility into pro-actively updating links.

    A note on marketing redirects

    This post is less about setting up multi-channel marketing campaigns and more about about retaining visitors when moving content. Search Engine Watch has a great article on why and how to conduct a redirect audit, but the author was unaware at the time that it’s possible to capture analytics data on these redirects. Most others are unaware of the pitfalls of other methods of tracking redirects.

    Some of our schools’ marketing departments use redirects for marketing. Vanity URLs are commonly used for print, television and radio ads. Those vanity URLs are easy for visitors to manually type into a Web browser. Once entered, the visitor is redirected to a longer and less memorable URL, possibly a deep landing page with a call to action. These redirects have different requirements. Most of the time, the visitor is arriving directly without a referring source and campaign attribution is important. Marketers want to know how many visitors came through the redirect, what those visitors accomplished on the site including sales and other conversions, and attribute the activities back to the campaign that brought them to the site. They have multiple tools at their disposal for campaign tagging, including URL shorteners like bit.ly, and autotagging for Google Adwords.

    This series of posts examines the current methods of tracking redirects through analytics, and discusses a new method and what it is best suited for. Part 2 provides a technical implementation. It factors in:

    • ease of setup
    • purpose
    • search engine optimization
    • unintended affects on analytics data
    • collecting data about the redirect

    Three methods to track redirects in Web analytics

    This post examines three different methods. Each assumes we start with a 301 redirect as best practice. The next post expands on the third option with an in depth look at how to configure redirects and the JavaScript that creates the event, and other options.

    Landing page with meta refresh to destination

    This method is old hat and is not recommended. The original link redirects to a landing page. That landing page records the redirect as a pageview in Web analytics, then uses a meta refresh to redirect the user to the destination page. The refresh timeout can be set to a length long enough for visitors to read a message about the page moving to the final URL. For example, delay the refresh by 7 seconds and provide a link to the destination URL.

    <meta http-equiv="refresh" content="7;URL='http://bar.com/'">



    • Redirected page tracked as pageview
    • Possible to include a custom message on redirect page


    • SEO: landing page receives authority, but does not pass authority to destination page.
    • Not ideal to boost pageview stats by including a redirect page (very similar to a virtual pageview though technically a pageview)
    • Requires manually setting up each meta refresh page to redirect to another location. Not ideal if dealing with hundreds of redirects.

    Destination URL with campaign code

    For visitor retention purposes, this method is simple to set up but will wreck your source analytics. The campaign code overwrites any source data (in Google, the visitor’s source is set in the __utmz cookie).

    Simply ask the network/server admin to append the campaign code to the destination URL. Set your parameters for utm_source, utm_medium and utm_campaign. Use a hash tag (#) to parameterize the campaign code instead of a question mark (?), and add _setAllowAnchor(true); in the Google Analytics tracking code so that Google accepts the hash tag campaign.


    This method is more suited towards marketers. If search is not a valuable part of the campaign strategy, skip the 301 and use a 302. You could even bypass the networking/server admin team and use a meta refresh on any generic Web page.



    • Set up: simple to set up once
    • Bounce Rate Calculation: not impacted
    • Ideal for marketing campaigns where visitors are arriving direct to the site (referral information not needed)
    • SEO: destination page receives search authority. Note that parameterized URLs can be considered different content to Google and Google will list that URL as a separate page in its search results, thus splitting search authority for one page between multiple URLs. To avoid the duplicate content issue, swap out the question mark for a hash mark and specify _setAllowAnchor(true); in Google Analytics.


    • Source: lose referral data from visitor. In Google Analytics, find this information in Traffic Sources > Sources (source = campaign source)
    • Not always running a marketing campaign (redirect for a moved domain is not a campaign, though a special domain that redirects to website for a TV or radio ad is a campaign)
    • No custom message possible
    • Set up: Requires a custom campaign code for each redirect (to effectively track multiple redirects). Not ideal if dealing with hundreds of redirects.

    Destination URL with hash tag, triggers JavaScript event

    This is the most robust, flexible and well suited method to track redirects for visitor retention. It’s a content centric approach and helps you maintain your content so visitors can continue finding content long after the domain has moved.

    Ask the network/server admin to append a parameterized hash tag to the destination URL. This can be anything simple, such as #domain-redirected.


    Then write a short JavaScript snippet to evaluate if the URL contains the parameter (pattern match on window.location.href).

    if (window.location.href.match(/#domain-redirected/i)){
    //do something, like push out a google analytics function (see below)

    If the domain contains the hash tag, then push out a _trackEvent call to Google Analytics. Be sure to set non-interaction (implicit count) to true so the event does not affect the visit’s bounce rate calculation (events by default are counted as an visit interaction, which factors into the bounce rate calculation).

    _gaq.push(['_trackEvent', 'inbound-redirect', 'referral', window.location.href + ‘?source=’ + document.referrer, 1, true]);

    In the example above, _track event has the following attributes set:

    • category = inbound-redirect
    • action = referral
    • label = {{destination URL}}?source={{referral URL}}
    • values = 1
    • implicit count = true

    Put these two items together, and you have:

    if (window.location.href.match(/#domain-redirected/i)){
      _gaq.push(['_trackEvent', 'inbound-redirect', 'referral', window.location.href + '?source=' + document.referrer, 1, true]);

    If this sounds daunting, my next post introduces a JavaScript that automates redirect tracking in Google Analytics and refines the source that’s reported to GA . It takes most of the heavy lifting out of the equation. I’ll also provide a walk-through for how to configure the script, what it does and why its done. For instance, some of the enhancements include abridging search strings, tracking visits as “direct” if document.referrer is not set (blank) and providing visitors with a visible message about the content’s new location.


    Google analytics ignores hash tags as anchors. Search engines ignore hash tags for the same reason, that the content is seen to originate within the URL without the hash tag (as an anchor points to a place within a document).


    • SEO: destination page with hash tag receives authority and avoids the duplicate content issue where Google indexes multiple URLs for one page.
    • Visitors arriving from redirected source can see a custom message
    • Source: Provides full referrals including URLs on:
      • search engine referrals (Google/Bing/Yahoo)
      • website referrals (full URL)
      • direct visits
    • Source: keeps original referral data. In Google Analytics, find this information in Traffic Sources > Sources > Referrals
    • Bounce Rate: not impacted. Event doesn’t affect bounce rate (set non-interaction to true)
    • Set up: Configuration can be scaled to an entire network of websites with little effort. Once the JavaScript is configured, the server admin or networking team just needs to append the hash tag to all relevant URL redirect patterns.


    • Sometimes you want to track redirected visits in a campaign. For instance, a domain redirected for a TV or radio ad should be attributed to the campaign, as should conversions made during these visits.
    • Visitors that bookmark the full URL in their Web browsers, then revisit the page through their bookmark, will appear in the site’s analytics as if they came from the redirected URL. Even though these visitors did not come through the redirect, they are logged in analytics as a redirected visits because they accessed the URL with the hash tag.

    That’s a wrap

    Visitor retention is as important as customer acquisition. It’s easy to overlook your visitor base, existing backlinks and the PageRank you’ve earned over time. Tracking redirects and keeping tabs on these areas reduces the likelihood that you lose relationships and business opportunities that your team has already built up.

    Campaign codes are a great tool for keeping tabs on redirects in marketing endeavors. For content refreshes and domain migrations, track redirects through events. Forget inserting pageviews to track redirects, whatever the need may be, the impact on your Web analytics is too great.

    Part 2 of this series goes in depth on setting up an analytics JavaScript that tracks redirects through events in a way that’s clean and simple.

    Posted By:


The Digital Analytics Blog is a fun take on analytics for professionals involved with Web, social media or apps that enjoy working with quality data, visualizing information, and optimizing their properties.

This is the beginning of the journey. If you enjoyed reading a post, visit my about page and leave me a message!