The s.abort Flag

With the release of H.25.3 in January 2013, the Javascript code was augmented with the s.abort flag — a flag that when set instructs the core Javascript code to not fire the tracking request.

Uh, what?

Where would you use that?

In the interest of keeping the page tagging light (do we have to go into why that is a good idea?), as much of the work done by Javascript code as possible should sit in the s.doPlugins call back method. And this is where you would use s.abort.

What for?

There is an example in the release notes that looks like this:

s.doPlugins = function(s) {
     s.campaign = s.getQueryParam("cid");
     if ((!s.campaign) && (!s.events)) {
          s.abort = true;
     }
};

This code basically aborts all tracking unless there is a campaign tracking code or at least an event happening.

Other use cases include:

  • Cancelling tracking for a rotating banner once it has rotated all the way through
  • Cancelling tracking on exit, download or custom links
  • Cancelling tracking in any other situation that can happen on your site

Let’s look at a specific use case for cancelling tracking for custom links: imagine you have a widget for social sharing. Imagine you are able to tag that widget, because your friendly marketer definitely wants to know when people share content. So far so good.

Unfortunately, the rules are different for the different networks and so your catch-all approach for tagging all social media share/like/pin/… activity might in some cases have to be altered.

For those cases (*cough*facebook*cough*), you can implement special code and just cancel the tracking call coming from the widget.

Another widely used use case: cancelling tracking when Safari or Chrome load the page in “preview” mode. Google calls the feature “Instant Pages”, Apple calls it “Top Sites”. In both cases, the browsers load pages before a user even decides to look at them, which obviously inflates your web analtics data.

So, you might want to cancel tracking in those cases.

For Safari, look out for the X-Purpose: preview header. If it is present, use s.abort = true; to cancel the tracking call.

For Chrome, you can use the Page Visibility API.

One more use case: switching tracking off completely. If you do not have a complete list of tagged pages but you really want to switch off tracking with Adobe Analytics completely, all you have to do is to set s.abort = true in the s.doPlugins method in the s_code.js file or files.

Crude but effective.

The s.abort flag, support for tracking long URLs as well as the addition of a new fall back for visitor identification actually made H.25.3 a pretty big release, much bigger than the announcement sounded like.

3 thoughts on “The s.abort Flag

  1. Hi,

    I know this is a pretty old topic, but do you know if Adobe is automatically suppressing the server calls when content is pre-fetched. I hope that a server call will go through only if and when a page
    is loaded completely.
    I see that Adobe already (since 2012) filters out pre-rendered content, until someone visits the page:
    https://blogs.adobe.com/digitalmarketing/analytics/sitecatalyst-15-3-and-javascript-h-24-4-released/

    Thanks,
    Panagiotis

    Like

    1. Hi Panagiotis,

      To be honest: I’m not sure. I would guess that yes, pre-fetched content is NOT tracked, but if you absolutely must know, you should test it.

      My belief here is based on what Product Management said in 2012, and some discussions I had with people since then. Nothing official.

      Cheers,
      Jan

      Like

Leave a reply to Panagiotis Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.