s.abort flag can prevent hits firing in Adobe Analytics

ALARMA! ABORT! ABORT! WHERE IS THE PANIC BUTTON!? Ok, somebody should sleep more.

Back to business. We have used our own custom functions to make tracking call on our website and inside Adobe’s script we populate the official s.t() or s.tl() call if the terms of our own function is ok. Usually we check at least that the domain matches to our domain. I know, not a 100% secure for all situations, but little precaution that we don’t populate hits e.g. from our dev environment etc.

When I started to #RUNDTM. In English, please? Ok, I started to use Adobe’s dynamic tag managment on one of our site. We had to implement official DTM scripts to our site and were unable to use our custom functions. You know the question I had to ask from myself… How could I now abort the hits if the domain isn’t matching?

I knew I had heard about some kind of abort function Adobe offers out of the box, could that be something useful? I looked from the help section and found a small information about this s.abort flag. Here is the link https://marketing.adobe.com/resources/help/en_US/sc/implement/abort.html

In DTM go to Adobe Analytics (tool) settings and scroll down to “customize page code” and click “open editor” and add the code:

function s_doPlugins(s)
if (s && (document.location.hostname.match(/\.(anttikoski)\.fi$/) === null))
s.abort = true;
console.log("Oh no! abort fired!");
{console.log("abort not fired, all good");
s.doPlugins = s_doPlugins;

Perfect, it works! Now the hits are aborted on my own blog if domain isn’t anttikoski.fi (I also check is s object alive). For testing purposes I also added console.log comments so I can debug and be sure that my code works. I have heard that you shouldn’t add console.log to production environment like I did, because there might be some older browsers that could get errors with those, not sure is that the case.

I’m sure there are many other cases where you want to check something and then decide by using “if” should the code make the hit or not. You could for example check if form submission contains internal email address like @yourcompany.com and if true then abort the hit, because maybe you don’t want to count internal test leads etc. “To be or not be”, by famous s.abort flag user.

About Antti

Digital Analytics Manager specialized in Adobe Analytics, Online personalization, SEO, CRO...

Leave a Reply

Your email address will not be published. Required fields are marked *