Reputation: 1159
For the past few days I have been messing with the basics of tag management and "disassembling" the GTM code, trying to figure out how this thing really works. There is one thing I cannot figure out:
Scenario 1.
It works like this:
Scenario 2.
Question:
Can this somehow be done via GTM interface? If yes, this means that I can somehow "inject" extra JS code into my page code after the page has loaded in the browser?
Cheers!
EDIT (after more education):
It seems that it is possible to do a lot. GTM checks if there is a datalayer on the page and if it cannot find one, it creates it for you. Uou then set up macros to push objects into this DL (events) and finally, you can have tags retrieve information from the DL and send it to the Google analytics. Am I right?
Upvotes: 0
Views: 922
Reputation: 484
You can use built in Universal Analytics Event tag to track .pdf downloads without dataLayer hard codding.
If you want to fire tags after page has loaded you can use "event equals gtm.load" condition in firing trigger. For example, you can use it to fire customer HTML tag with any kind of Javascript code.
Upvotes: 0
Reputation: 85
You could create your own "DataLayer" by creating a dedicated tag declarating an array but this personal DataLayer could not be use in triggers.
To cover that, you can use another tag with a test (if array contains X then function ...), but I could not see how that is better than your scenario 1. If you do that, be sure to use tag priorities so the first tag is triggerred first.
Upvotes: 0