Learn business growth with Google Analytics 4 Forums Google Analytics 4 Trouble with GA4 visibility of events pushed through Gaq

  • Trouble with GA4 visibility of events pushed through Gaq

    Posted by Isaiah on 11 November 2022 at 9:56 am

    Hey there!

    Just wanted to chat about tracking code related stuff. So, here’s the thing – we’ve been using a custom tracking code to track events in UA, and it’s been sailing smoothly till now. However, we’re faced with shifting all these events over to GA4 before a looming deadline, and although I’ve got GA4 fitted on the website, the events aren’t showing up there. To give you a peek, here’s what a typical event looks like.

    “_gaq.push([‘_trackEvent’, ‘EventCategory’, ‘EventAction’, ‘EventLabel’]);”

    Now, say ‘Homepage’ is the category, ‘PretSmallBanJan2023Stars’ is the event name, and ‘Banner’ is the event label. It would look something like “_gaq.push([‘_trackEvent’, ‘HomePage’, ‘PretSmallBanJan2023Stars-CH’, ‘Banner’]);”

    We’ve got a whopping 15k events like these, all of which need to shift base before July. If you can help us maintain the same setup and still manage to have the data reflect in GA4, it would really save the day!

    Thanks and regards!

    Jordan replied 1 year, 4 months ago 3 Members · 2 Replies
  • 2 Replies
  • Brooke

    Member
    19 February 2023 at 4:01 pm

    Hey!

    Alright, let’s tackle this together. Firstly, it’s important to know that in GA4, the idea of ‘Category’, ‘Action’, and ‘Label’ doesn’t exist. Do take a look over here to get yourself acquainted with GA4: [GA4 Guide](https://support.google.com/analytics/answer/9744165#zippy=%2Cin-this-article). The metrics between GA4 and Universal Analytics do differ – here’s a comparison: [Comparing Metrics](https://support.google.com/analytics/answer/11986666?hl=en#zippy=%2Cin-this-article).

    Right. Now let’s talk about creating custom events in GA4 – you’ll find this helpful: [GA4 Custom Events](https://support.google.com/analytics/answer/12229021?hl=en).

    For creating custom events, you have two paths – GTAG and DataLayer. Depending on your familiarity, you could choose either, though I think GTAG might be a little more straightforward as it uses the gtag.js API to send info or events to Google Analytics API.

    For GTAG, you’d need to follow these steps: [Set Up an Event for Website Apps](https://developers.google.com/analytics/devguides/collection/ga4/events?client_type=gtag). The function is pretty intuitive:

    `html
    gtag(‘event’, ”, {

    });
    `
    If you’d like to hold onto the Category, Action, and Label, I suggest you create Custom Dimensions for these three. You still get to keep your old database structure, and no added workloads for the developers. Do take a look here: [Custom Dimensions and Metrics](https://support.google.com/analytics/answer/10075209?hl=en). Please bear in mind, it takes a bit of time (about 48 hours) for GA4 API to recognise your custom dimensions.

    Alternatively, if you’d like to work with DataLayer, you’ll also need to interact with GTM or Google Tag Manager. Here’s more about it: [GTM](https://developers.google.com/analytics/devguides/collection/ga4/events?client_type=gtm).

    That’s a starter. Hope it helps! Cheers.

  • Jordan

    Member
    12 April 2023 at 3:36 am

    Sure, I can help with that! You basically need to change your old UA tracking code to fit the new GA4 standards. It’s a bit of a task, as GA4 works on “events” not “hits”, which is a shift in thinking. This means rewriting your tracking codes to fit this new structure, but I assure you it’s totally doable before your July deadline. Let’s get cracking!

Log in to reply.