[How-to] Create Triggers based on Unbounce Page Variant in Google Tag Manager

  • 29 August 2017
  • 2 replies
  • 22 views

Badge

Hey folks, for those of you using Google Tag Manager, I thought I’d share how I created triggers based on an Unbounce page variant. Very useful when A/B testing something outside of Unbounce that is delivered via script to your page!

(Kudos to Robert in support for providing some guidance on this!)


Instructions

Click Here for the how-to
  1. In Variables section, create a new User-Defined Variables, with type “JavaScript Variable”. Give it a name (I used “Unbounce Variant”) and for Global Variable Name, enter ub.page.variantId

  2. Go to Triggers section, create a new one with trigger type for Page View. Then add a condition for Page URL to match whatever page you’re trying to add your script to, and then add another condition with “Unbounce Variant” (if that’s what you called your variable) equaling whatever variable from your page in Unbounce that you want to use.

  3. From Tags section, add your new trigger (from #2) to whatever script you’re trying to fire on only some variants!




2 replies

Userlevel 7
Badge +1

Hey Andy!

Wow!! Thanks so much for sharing this here for other folks to benefit from, @Rob is pretty great, but I think you’re the real MVP here! 💪

Cheers!

Hey @Andy2,

Thank you so much for sharing this with the Unbounce Community! 🙏

I’ve moved this over to the #unbounce-tips-and-scripts category and added some tags to make it easier to find for others.

Also, big shout out to @Rob who helped out with this!

Reply