Google Optimize - How to Track Button Clicks


      1. The part of setting up GTM to correctly work with Optimize. Not exactly clear for those of us who are new to this. What name exactly is supposed to be used for “event names that you enter refer to the names by which they appear in Google Analytics” – would this be the Event Category? Action? or Label that we created in the Tag Configuration? Or none of these?

      2. “event names” = event category, event action, and/or event label. If you’ve entered an Event Action of “Clicked Contact Button” in GTM’s tag configuration, then you’d set Event Action Equals “Clicked Contact Button” in Optimize. The names need to match between the systems.

    1. You can extract the information with a script. I added in some information on that, please take a look and let me know if it answers your question.

    1. You again? It explains how to track button clicks, including the exact tag and trigger setup — you just need to substitute in your own button’s CSS selector. Do you have a specific question about it?

  1. Yeah the tutorial is nice, but I agree with “Anonymous” on the fact that this part is not clear (unless I am very dumb and didn’t get it). At the end of Step 5, you’ve created a tag & trigger & variable in orde to track your specific button clicks and attributed a name to each of them. We can now start again at the beginning of Step 5 but where do you enter this tag/trigger/variable in ? Do we have to replace “Clicked Contact Button” by the something we’ve created with GTM ? I hope I was clear in my questions. Thanks for the rest though

    1. Hi Sebastien, in the example, I named Event Action in GTM as “Clicked Contact Button”, so I selected Event Action Equals “Clicked Contact Button” in the Optimize Objective configuration page. (Step 4 shows how to access the Objective configuration: “Under Configuration > Objectives > Experiment Objective, you’ll see 2 options: ‘Choose from List’ and ‘Create custom.’…Since we want to track button clicks, you will instead select ‘Create custom’.”)

      If you name your event something other than “Clicked Contact Button” in GTM, then you’d use that name instead in Optimize. Please let me know if that answers your question.

  2. Thanks for posting this, it was really helpful! Keep on the great work.
    For my case I had to compare the values on some inputs for an A/B test, just took me a few tweaks of your solution to achieve this.

  3. Hi Ana. I wanted to add my thanks here. The post wasn’t initially about what I was looking for, but I decided to read through it anyways. I only run redirect tests and was looking to track phone clicks through Optimize so I could have all of my data easily displayed in one place. Step 5, in particular, showed me exactly what I needed to do, and it works beautifully. So thanks!

    1. I know what that’s like, digging through a post to find the relevant slice of information. Thank you for persevering, I appreciate the comment.

  4. Hi, Ana.
    I find your article useful and enough eloquent if there is a decent knowledge on GO and GTM. I liked the part with tracking the color version in GA.
    Thank you!

  5. Thanks for this, It’s made my task to get this exact test working in Optimise so much simpler than gazing at the documentation for 30 hours XD

  6. Hi. Thank you for this article. I have made an event using GTM by following the instructions you gave. I am not sure why GO is still giving me this notification even without doing edits in the first place– “Page modified after initial load…”

  7. Hi Ana, thanks for the detailed post, I was looking to add my custom event tracking to analytics and optimize and your blog post was perfect. Cheers

  8. The tutorial is great! Could you explain how one could create a tag for A/B-testing where the variants differ in filter-buttons. They are not proper buttons (not “btn” in the code).

    1. Thanks for the kind feedback. The general process is the same regardless of the exact element you’re testing, it just means you need to set up your event tag on the filter element rather than on a button click. And that works the same way, too: find the CSS element that represents clicks on the filter, or have your devs pass in a data layer event for that action, and then set up a tag based on that. Does that make sense?

  9. Hey this is great! i’ve tested it and its works like a charm.
    I even did the GTM stuff just with what you explain here.
    Thank you very much! This has been really helpful!

Leave a Reply

Your email address will not be published.