Kill Switch for Adobe Analytics using DTM

后端 未结 1 367
再見小時候
再見小時候 2021-01-03 14:32

Background

We currently have a flag in the datalayer that when it\'s set to false Adobe Analytics code will not run.

We do this

1条回答
  •  迷失自我
    2021-01-03 15:10

    DTM does not currently have any page load rule to not output any code, nor does it have any way to conditionally suppress the call.

    AM itself though does have an s.abort variable that you can set to true and it will suppress the next s.t or s.tl call. But DTM doesn't have that var built into it's interface so you have to put it in the custom code section of the rule.

    Update: To reiterate, s.abort doesn't wholesale suppress all AM calls; it suppresses the next call. After the call, AM resets s.abort to false. So this will work great for initial page load rule but for example if you have any code popping after page load (e.g. exit/download link tracking or some other custom code you may have), it will not suppress that.

    Even if you are not doing custom after page tracking, one place to make sure you account for is in the Tool config where you can specify download tracking and internal/external link tracking which AM natively pops for if you have enabled (basically DTM's interface for linkInternalFilters, trackDownloadLinks, trackExternalLinks, linkDownloadFileTypes, and trackInlineStats). There's no easy way around that as far as keeping those things enabled via those settings, so I think the best thing to do for that is to just disable them and replicate it with event based rules, so that you can incorporate s.abort into there.

    Another note to consider: s.abort suppresses the final request to Adobe but pretty much everything leading up to the actual request is executed. The most notable thing to consider is that if you have doPlugins enabled (DTM doesn't currently have this in the interface but there's nothing stopping you from enabling it and defining it yourself in custom code), it will get executed. This may have an impact on any logic you have in there, particularly stuff that does cookie reading/writing.

    For example, let's say you have an "engaged visitor" metric that is set to pop after a visitor has viewed 3 pages and you achieve this by using a cookie to store and increment a value and read the cookie and pop an event if it reaches 3, and this is all in your doPlugins function (or elsewhere in a page load rule), s.abort will not suppress any of that.

    0 讨论(0)
提交回复
热议问题