by Doug


Google Tag Manager, Web Development

Superweek 2017 Golden Punchcard Winner

Taking triggers up to 11

We’ve just returned from another excellent Superweek in Hungary. If you were there, you’ll know it was, without question, the best ever. If you weren’t (srsly, book 2018, you won’t regret it), you can read a selection of summaries from datarunsdeep and Analytics Demystified to get a flavour of the depth and quality of the show.

One of the personal highlights was (finally) winning the Golden Punchcard prize. I’ll describe the solution in more detail in this post and/or you can have a blast through my slides.

Here’s me gurning like a buffoon because I was quite pleased…

In case you’re wondering, the message encoded in the gold plated punchcard reads:

“golden punchcard prize@superweek2017 Feb 1*digital analytics summit galyateto hu”

What is it?

This is an experimental technique that demonstrates the unification of targeting for marketing, measurement, optimisation and personalisation. Essentially, you can use audiences in GTM tags, triggers, variables. Additionally, you get to use any Google Optimise test targeting mechanism in GTM.


Okay, here’s how to make triggers great again:

Set up a blank test in Optimise like this:

Now you need to apply test targeting. The choice of test targeting reflects the type of data you want in GTM. I wanted to demonstrate Audiences in GTM Triggers (with good reason as I’ll explain later) so I chose a simple example – targeting using an audience covering “direct” visitors to my site. More correctly this is the audience of users who have visited my site via the “direct” channel at some point in their life.

Okay, we still need to apply URL targeting – this is mandatory – but we’ve also added an audience to the targeting logic. We’re done here – time to start the test. When you do, make careful note of the experiment ID as we need that for the next step:

Now our test has started, when a user lands on the site and they’re in the “direct” audience, the test will activate…and do nothing. Well, not quite nothing. It leaves some handy evidence that we can pick up using JavaScript.

The gaData variable is available for inspection. It tells us some pretty useful things. Look at the example below. I’m on the ConversionWorks homepage, I’ve opened a dev console and I’m inspecting gaData:

I can see the gaData object contains an object with the same name as my GA tracking ID which, in turn, contains an array of running experiments. The array of experiment name value pairs contains the experiment ID and the index of the variation being shown to the user. We can just ask gaData if a particular experiment is running like this:
gaData[‘your tracking ID’][‘experiments’][‘experiment ID’] !== undefined

This line of JS can go live in a GTM custom JS variable for later use:

For example, in a trigger:


Notice that this is Page View trigger but it’s using Window Loaded rather than the normal Page View (gtm.js event). We need to let the Optimise tag do it’s thing before we start looking under the hood at the resultant gaData variable. Sure, we’ve got Optimise firing nice and quickly (a setup tag in sequence on the pageview tag with 9999 as the firing priority) but it’s async – we cannot finely control the firing timing so we need to go with the safe option a bit like when extracting the GA clientID.

Yeah, and?

That’s the essence of the technique. You can see how other Optimise targeting mechanisms could be used instead: Geo location, device category or time since first arrival for example. All very powerful…


The real point is the unification of marketing, measurement and personalisation (p13n ?). We’ve seen the success that pours forth when these disciplines collaborate and join up their thoughts.

The ultimate beneficiary is the user of course. Their advertising is more relevant. The on site experience mirrors the campaign messaging. The measurement is solid and the whole engagement just makes more sense.

Tim Wilson fairly and accurately described this technique:

…walked that fine line between “really clever” and “a bit of a hack,” but I think they both fell firmly in the former camp

Yep, I’d take that. It’s an experiment to demonstrate the principle and to provoke further thought. I expect this “trick” to have a short shelf life. It seems folly not to anticipate GTM triggers offering similar capabilities at some point. I, for one, will welcome these tools to enable marketing and optimisation to do a better job.

That’s it for now – expect another couple of updates that touch on similar subjects and demonstrate real-world #rocketsurgery.


Leave a comment

Your email address will not be published.

ConversionWorks is now Media.MonksVisit us at