Profile

Cover photo
Verified name
Brian Kuhn
Works at Google
199,553 views
AboutPostsPhotosVideosReviews

Stream

 
We've launched a new Auto-Event listener tag.  Once it's fired, it listens for uncaught JavaScript exceptions on your page and pushes information about those errors onto the dataLayer.

(as mentioned here: https://plus.google.com/106091905429925862702/posts/i34twe4tyro)  
20
2
Sebastian Breidert's profile photoMichel Vennema's profile photoTahir Fayyaz's profile photoPhil Pearce's profile photo
8 comments
 
gtm.errorUrl is a known issue (see comments on the images for this post).  It will not work in either version of the dataLayer.

This will be fixed in this week's release (currently scheduled for Wednesday).
Add a comment...
 
The dataLayer is a simple API for page authors to emit data about their pages, so that tools like GTM can consume that data.  

GTM uses the dataLayer, but other tools should be able to use it too!  This is why we created the data-layer-helper project on GitHub.  It's an open source library for other tools to use, so they can read and listen to the dataLayer in the same way that GTM does. 
9
5
Jordi Mon Companys's profile photoAndré Mafei's profile photoStephane Hamel's profile photoMaksim Kvitsinskiy's profile photo
 
Good stuff!
Add a comment...

Brian Kuhn

Sharing  - 
 
 
GTM Tip: Store your +Google Analytics Property ID in a Macro

Here's a quick tip for all you Google Tag Manager users. Store your Google Analytics property ID in an Macro. Why?

Whenever you add any type of Google Analytics tag to a container you'll need to enter your property ID. You can type it in manually.

BUT, if you store it in a Macro, then you just need to reference the Macro when you add an analytics tag. No need to type it in every time.

Now you have more time to take a break!

#googletagmanager  
7
Stephane Hamel's profile photo
 
That's always what I do, and even better, I use the new table lookup macro to set it to a test web property when {{debug}} is true. 
Add a comment...

Brian Kuhn

Discussion  - 
 
Every rule in GTM must be tied to one or more events.  

If a rule does not inspect the event macro, GTM automatically adds an implicit {{event}} condition such that "{{event}} equals gtm.js".  

This means that if you don't check the {{event}} macro in your rules, your tags will only fire during the gtm.js event.  If you don't want your tags to be limited to the gtm.js event, you'll need to add conditions like:

    {{event}} equals gtm.dom
    {{event}} equals customEventName
    {{event}} matches .*

[Meta comment: I was going to put this in a comment responding to +Phil Pearce's post, but this is kind of a key concept in GTM, so I want to make sure it doesn't lost in the shuffle:  https://plus.google.com/117298997433687198127/posts/SiHsjBj6EAE ]
5
1
André Mafei's profile photoJulien Coquet's profile photoStephane Hamel's profile photoPhil Pearce's profile photo
10 comments
 
The dataLayer is simply a queue of messages.  Each message is processed in the order in which it was added (FIFO).

You can initialize the queue with zero or more messages, or you can let the GTM snippet initialize the dataLayer for you.  Any time after initialization, you can append messages onto the queue using the push method.

As mentioned above, the GTM snippet will look to see if the dataLayer exists, and create it if necessary.  Then, the GTM snippet will push the {event: 'gtm.js'} message onto the queue and will load the GTM JavaScript (googletagmanager.com/gtm.js).

When /gtm.js loads, it will add listeners for the DOM-ready and window.load browser-events.  When those listeners are executed, they will push the {event: 'gtm.dom'} and {event: 'gtm.load'} messages onto the dataLayer (respectively).

Again, you can push messages onto the queue at any time after initialization.  You can push your custom messages before and/or after the {event: 'gtm.js'} message.  But since the gtm.dom and gtm.load events happen asynchronously, in-page custom messages may come (non-deterministically) before or after these events.

If you want to make sure your messages come after these events, pushing your messages from a Custom HTML tag tied to these events is probably your easiest option.  The only surefire way to make sure custom message come before the gtm.dom and gtm.load events is to make sure they come before the gtm.js event.
Add a comment...

Brian Kuhn

Sharing  - 
 
Another good article from SwellPath.  It demonstrates a very useful technique for understanding the events being pushed onto your dataLayer.  Nice job +Nicholas Blexrud!
10
1
Nicholas Blexrud's profile photoSteve Chapman's profile photoAndré Mafei's profile photoAl Wightman's profile photo
3 comments
 
+Brian Kuhn This article has just solved a big headache I was having. Thank you!
Add a comment...

Brian Kuhn

Discussion  - 
6
1
André Mafei's profile photoDamion Brown's profile photo
2 comments
 
GA + GTM = great car + great road = I love it
Add a comment...

Brian Kuhn

Sharing  - 
 
The "Element Text" macro for Auto-Events has now launched.  This will return the innerText from the element that caused the auto-event.  

Keep in mind that browsers have a few irregularities here.  For example, IE will consolidate whitespace in ways that other browsers don't.  In our next release, we'll normalize these differences, but in the meantime, you may need to keep an eye out if you're trying to do something like exact matching.
17
2
Sebastian Breidert's profile photoJean Michotey's profile photo
Add a comment...
 
Reminder that this is happening today (soon).
 
Join Developer Programs Engineer +Andrew Wales , Product Manager +Lukas Bergstrom, and Software Engineer +Brian Kuhn as they discuss Google Tag Manager, using a data layer, and GA's open-source library for working with a data layer. 
3
Brian Kuhn's profile photo
 
This is also available on YouTube for those that missed it.
Behind the Code: Using the Data Layer
Add a comment...

Brian Kuhn

Sharing  - 
 
A new macro type (Lookup Table) has been launched.  It's useful for creating mappings between sets of values.  For example, you could map URL paths to account IDs, or perhaps some custom dimension.

Use this by picking an input macro, like {{url path}}.  When the input macro matches a row in the first column, the lookup table macro will return the corresponding value in the second column.
27
8
Sebastian Breidert's profile photoPhil Pearce's profile photoChristoffer Luthman's profile photoZorin Radovancevic's profile photo
12 comments
 
CSV import!
Add a comment...

Brian Kuhn

Sharing  - 
 
Just pushed out the docs for some new features.

Many people don't know that GTM supports blacklisting tag types from the page.  This gives page authors (IT) full control over what kinds of tags can run on their site, since the in-page blacklist will always override the configuration in the container.  So even if someone adds a "Foo" tag to the container, it will never fire on pages that have blacklisted it.

We've recently made this support even stronger.  GTM now supports blacklists and whitelists.  You can block tags and macros based on type, but we've also added support for tag/macro classes, which allow you to block capabilities (like the ability to inject non-Google scripts).  This allows you to not only block current tags and macros, but also any new tag and macro types that get added to GTM in the future.
8
2
Eivind Savio's profile photoBrian Kuhn's profile photoPeter Jakus's profile photoSebastian Breidert's profile photo
4 comments
 
Thumbs up for your great job Brian.
Add a comment...
Work
Occupation
Software Engineer
Employment
  • Google
    Software Engineer, 2006 - present
Links
YouTube
Basic Information
Gender
Male
Apps with Google+ Sign-in
Enchiladas are pretty darn good here.
Food: ExcellentDecor: GoodService: Good
Public - a year ago
reviewed a year ago
Clean. Friendly. Yellow curry was great, but not spicy enough.
Public - 3 years ago
reviewed 3 years ago
2 reviews
Map
Map
Map