Yet another article about DTM… I guess by now I can’t even get away with calling it a “mini series” anymore, can I?!
Today, I want to share a tip that came in handy a couple of weeks ago while troubleshooting a relatively complex implementation with a lot of rules.
There are actually two ways, and I shall describe them both.
The Men Who Stare at Code
(Apologies for the non-inclusive title, I just couldn’t resist the movie title connection here.)
The easiest way to find where you’re setting a “variable” or event is to use the browser’s built-in tools. Let me show you how to do it with Chrome.
First, open the “Sources” tab in the “Developer Tools” and find the files loaded from “assets.adobedtm.com”. Under there, you’ll find one or two files that are called “satelliteLib-xyz”. Select the staging file. (I’m presuming you’re in staging)
Beautify the code (see tip #4 in David Vallejo’s article on debugging your GTM). Now you can use
CTRL-F to search for the “variable” or event you’re looking for.
Remember that you can see all the rules in the Console?
If we can see them, then we can iterate through them, right?
Now this is ugly:And what does it do?
Well, if you copy it into the console, then execute it, you get output like this:Ugly, but with a huge collection of rules, this might just be useful.
The snippet works for Event-based and Direct Call Rules, but it has to be modified a little bit for Page Load Rules.
You can check what rules look like by just typing
_satellite.pageLoadRules into your console and inspecting the resulting objects. I’m sure you’ll find a similar way to look for eVars or props…