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.

About

German expat living in Switzerland (formerly UK and France). Consultant and member of the Multi-Solutions Group at Adobe, working with the Digital Marketing Suite. Father of 4 girls.

Tagged with: ,
Posted in Javascript, Tips
One comment on “The s.abort Flag
  1. […] Sure: a kill switch using s.abort, conditional choice of report suite ID using s.sa(), measuring “engagement” that takes […]

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Enter your email address to follow this blog and receive notifications of new posts by email.

Join 1,398 other followers

%d bloggers like this: