Search code examples
google-analyticsgoogle-tag-managerevent-tracking

Why is can't I see event action in google analytics?


This morning I used google tag manager to collect clicks on the product pages of this website, e.g. www.lptent.co.uk/products/co. The buttons that I really want to track are "Configure my Gazebo" and "Generate quote" but I can't see them in analytics' Event Action column.

I am using the {{element id}} for the Event Action in tag manager and I can see other IDs that have been clicked in analytics. I have also checked that the tag fires when I click these buttons but I still can't see them. The domain of the website does change when these buttons are clicked so maybe that could have something to do with it?

Help appreciated!

Andrew


Solution

  • I've been working on this recently and was hoping to get things working automatically in GTM. I didn't quite work out that way so I've been pushing the Event to the dataLayer and picking it up from there. This page has all the information I needed to create the events and set up GTM to pick them up from the dataLayer

    https://www.distilled.net/blog/getting-started-with-google-tag-manager/

    I tried using the jquery $('elementID').click() handler to do this but although it worked fine in testing it didn't when I rolled it out.

    $( "#ElementID" ).click(function() {
    dataLayer.push({'event': 'trackEvent', 'gtmCategory': 'myCategory', 'gtmAction': 'Click', 'gtmLabel': 'LinkName'}); });
    

    Instead I just used

    onclick="dataLayer.push({'event': 'trackEvent', 'gtmCategory': 'myCategory', 'gtmAction': 'Click', 'gtmLabel': 'LinkName'});"
    

    to fire the event and this seems to work with both links and Form Submit buttons. Strangely the jquery $('ElementID).load works fine (there is a good reason for that!)

    I know it's not quite as elegant as GTM seems to promise but it does seem to work.