- TLC Home Home
- Discussions Discussions
- Documentation Documentation
- Knowledge Base Knowledge Base
- Education Education
- Blog Blog
- Support Desk Support Desk
02-20-2019 01:58 AM
I know we can stop a certain tag from firing by scoping an Extension to Tag X and have this Extension return false.
But how do we do this for ALL Tags?
The use case is:
A client's website keeps firing utag.view Events at some points where those should not be fired. Waiting for the release to fix this will take months. We send those Events to all kinds of tools.
We can identify the false events easily (they are Cart View Events even though the user is not in the Cart), but how can we tell Tealium "stop execution for all Tags" in an All Tags Extension? Returning false in an All Tags Extension does not abort execution for All Tags like it does when it is scoped to a certain tag.
So in short: We COULD create an Extension like that and scope it to all tags manually by adding in all the tags in question, but that seems like a waste of code (the extension code is then duplicated for all those tags) and it is also less sustainable as new tags would not be part of the Extension and we would have to think about adding them each time we create a new tag.
There must be something more elegant.
02-20-2019 05:40 AM
02-20-2019 08:58 AM
02-28-2019 04:34 AM
Hi @loldenburg
I had a similar situation only from the Tealium SDK in Android App. We kept getting double server calls where one is "utag.view/link" and the other is "remote_api". These extra calls are for the Tealium TagBridge and unless you need them should be ignored. No tag was firing based on this call but it did pass through all our code and in some cases causing extra increase to counters since two server calls contains the variableX++ and so on.
The solution here is similar to what you want to achieve for a tag scoped extension where you can return false. More or less it looks at the call and determines if it should be used or thrown. Here is the code I am using:
if(typeof(window.oldTrack) != 'function') { window.utag = window.utag || {}; utag.oldTrack = utag.track; utag.track = function(a, b) { if (a == "remote_api") { return; } else { utag.oldTrack(a, b); } } }
Test it thouroughly before using to make sure it isn't causing anything unexpected. Even though my setup is for App, I expect it should be possible to use on a web setup as well.
02-28-2019 07:24 AM
08-28-2019 05:52 AM - edited 09-02-2019 06:24 AM
I'm trying to achieve this same behavior. In my case it's blocking utag.view calls when widget_name is in the list supportiveWidgets:
(function blockSupportiveWidgets(a, b) { if ( a === "view" && ((b.state_name != null && b.state_name === "init:state") || (b.event_name != null && b.event_name === "init:state")) ) { var supportiveWidgets = ["chat-client-nl-widget-ec"]; if ( b.widget_name != null && supportiveWidgets.indexOf(b.widget_name) > -1 ) { utag.DB( "blockSupportiveWidgets - utag." .concat(a, " call from ") .concat( b.widget_name, " blocked because it's in the list of supportive widgets (" ) .concat(supportiveWidgets.join(), ")") ); utag.loader.cfgsort = []; } } })(a, b);
Setting utag.loader.cfgsort to an empty array seems to do the trick, but I'm still testing before it's production-ready. Will let you know how that goes.
08-31-2019 02:35 PM
09-02-2019 06:22 AM
I ended up using a tag-scoped extension that returns false, as @loldenburg mentioned in his original post, which I'll paste here for reference:
function duplicatePageViewHack(b) { var sendPageView = true; var cooldownSeconds = 2; var currentPageView = { "dom.pathname": b["dom.pathname"], tealium_timestamp_epoch: b.tealium_timestamp_epoch }; /* Make sure no pageviews are sent from this list of widgets */ if ( b.widget_name != null && [ "chat-client-nl-widget-ec", "personal-contact-info-widget-sc", "content-widget-mijn-abnamro", "content-widget-my-abnamro", "chat-client-nl-widget-wpp", "content-widget-my-abnamro-business" ].indexOf(b.widget_name) > -1 ) { sendPageView = false; utag.DB( 'duplicatePageViewHack: No Adobe Analytics page view because widget_name "'.concat( b.widget_name, '" is on the blacklist' ) ); } else if (sessionStorage.tealium_last_pageview != null) { /* Make sure no pageviews are sent during the cooldown period following a pageview from the same page */ var lastPageView = JSON.parse( sessionStorage.getItem("tealium_last_pageview") ); if ( lastPageView["dom.pathname"] === currentPageView["dom.pathname"] && currentPageView.tealium_timestamp_epoch - lastPageView.tealium_timestamp_epoch < cooldownSeconds ) { sendPageView = false; utag.DB( "duplicatePageViewHack: No Adobe Analytics page view because the previous page view from this page was less than ".concat( cooldownSeconds, " seconds ago" ) ); } } if (sendPageView) { sessionStorage.setItem( "tealium_last_pageview", JSON.stringify(currentPageView) ); } return sendPageView; } return duplicatePageViewHack(b);
09-02-2019 06:25 AM
I agree that this is functionality that Tealium should provide, but in case anyone wants to try this brutal hack, I've run it through Babel myself and pasted the result here.
Copyright All Rights Reserved © 2008-2023