Yes, I know, Launch. But I had this post in the pipeline for some time now, and here you go. As a bonus, I have noted where Launch, by Adobe, handles things differently.
If you came here from my “battle post“, then this is some background that’ll help you understand why I wrote the other post in the first place. Still waiting for Jenn to respond, by the way. I guess she’s now so focused on Launch that she won’t. *sigh*
I think we all understand by now that DTM (and Launch, by Adobe), is pretty much a script generator with a nice UI.
<head> of your site. With Launch, you can also load it asynchronously, which would change everything you read below, so we won’t deal with that option today.
This file is very similar to the good old
Depending on how you use DTM, that stuff all comes from you (if you manually host the library in DTM, like Jenn does, in which case it can also include plugins and the
doPlugins method), or it is assembled from the Adobe-hosted core code plus settings like for example the report suite IDs.
And there is more: whatever you write into the editor in the “Customize Page Code” section of the Analytics Tool/Extension ends up in a “customInit” structure, which DTM will execute when it loads the page. This is where the cool kids put things like plugins and the
Launch, btw, makes this even better, because it allows you to assign report suite IDs via Data Elements, hence eliminating the need to use
So when exactly does customInit happen? Is it really the same, or can it be made to function exactly like a standard
To test that, I put a
_satellite.notify() into the “Customize Page Code” editor and checked.
The code is executed before the first Analytics call is triggered by DTM, of course.
There is no difference visible on my simple test page between setting the Customized Page Code to “Before UI Settings” or “After UI Settings”.
In order to find out exactly when the custom code runs, I will probably have to build a more complex Web Property, with DCRs being called in the page and such. Given that Launch is the future, I might skip that.
Exceptions (when Jenn is right)
Analytics comes with the concept of “Modules”. Those are almost like plugins, but not quite.
1. The “Media” Module,
2. the “AudienceManagement” Module, and
3. the “Integrate” Module.
The Activity Map is also realised as a Module in Analytics code.
The big difference between Plugins and Modules is that Plugins are built to be executed inside the
This is the one and only situation where Jenn’s way of customising is
Now you know.
4 thoughts on “The Mechanics of Loading Analytics Code with DTM”
Good post Jan!
I follow your analytics article and i found it really helpful. thanks for making life easier for beginners.
Could you please help with the scenarios where creating a custom code in “Before UI setting” or “After UI setting” really makes the difference.
or we don’t have to worry on that part and we can create custom code on any of the option( before or after UI setting)
thanks in advance
Kuidip, i believe Before or After UI is only relevant if you are setting beacon variables in your custom code. It essentially sets which code gets to set variables last,