Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GTM event working but is not showing in Google Analytics Events, why?

I am trying to setup 1 click event to be fired in Google Analytics using the newest dataLayer object and have it set to be triggered like so:

$('.vinyl-calc .calculate').click(function() {
    // some code here...
    window.dataLayer = window.dataLayer || [];
    window.dataLayer.push({
        'event': 'calculatorClick',
        'calculatorType': 'vinyl'
    });
});

and

$('.silane-calc .calculate').click(function() {
    // some code here...
    window.dataLayer = window.dataLayer || [];
    window.dataLayer.push({
        'event': 'calculatorClick',
        'calculatorType': 'silane'
    });
});

I created the dataLayer variable correctly in Google Tag Manager and the tag named, "Tools and Calculators" with the custom event calculatorType added to it, which as shown below is being triggered via Google Tag Manager:

GTM Image 1 and GTM Image 2

However, going into Google Analytics, even in Realtime does not show any events happening here. I do not see anything at all in Google Analytics and can't seem to track this at all in Google Analytics. How to get the event calculatorClick showing in google analytics with the calculatorType variable???

I have been at this for hours trying all kinds of ways to get this working and nothing is working correctly. Some references I have followed that just do not work in Google Analytics are https://johannesmehlem.com/blog/google-analytics-event-tracking-via-google-tag-manager/#section3.4 and https://www.analyticsmania.com/post/pull-data-from-data-layer-google-tag-manager-tutorial/

1st - Why is this soo complicated? And how to get GTM linked to GA correctly so that it is tracking events? Because there are currently NO events in GA and I've been triggering these click events all day.

Here is the Tag and triggers in Google Tag Manager that are LIVE: All Tags in GTM and here is the Tools and Calculators Tag Properties. I'm not sure what the Category, Action, Label, and/or Value properties are supposed to have in them, so I've been testing different values in here to try to get it to send to GA (which it does not). Tools and Calculators Tag Properties

I actually have 3 triggers on this so as to be sure it is working. I suppose I only need 1, but I wanted to be sure it was working in GTM.

I don't know where you get to the TAGS in Google Analytics however. I don't see any option for tags anywhere in GA. Only in GTM.

like image 310
Solomon Closson Avatar asked Nov 07 '22 05:11

Solomon Closson


1 Answers

Each custom event in GA could have an Event Category, Event Action, and (optionally) an Event Label and Event Value

Now that I am not a superuser in GTM, I believe that you still need to map your data layer variables into the corresponding Google Event for that to show up properly within GA.

Google's Custom Event documentation
Google's GTM documentation


Updated GTM is just a way to help make it easier for developers to load data into GA or add custom scripts, etc. If you want to store them as GA events, you will need to understand how the GA Event works. That's why I include the Event documentation (which sadly refers to the dated ga method.) you can clearly see the eventCategory etc there.

  1. In GTM, you will need to set up data layer variable based on the event category you have pushed through.
  2. Then you create an Event and map those Event Category etc field to the corresponding datalayer variable.
  3. You then need to specify a trigger so that GA knows when to fire that event.

I believe the latest method is actually using the gtag. The default event snippet still uses the old ga syntax last time I checked.

like image 140
The Lyrist Avatar answered Nov 13 '22 23:11

The Lyrist