yash bhagchandani
yash bhagchandani

Reputation: 79

Gaq push events not showing in GA4

We are using a custom tracking code to track events in UA, which was fine until now, but as there is a deadline to move all the events in GA4, I have already integrated the GA4 to the website, but I couldn't see those events there. Following is an example of an event I use.

_gaq.push(['_trackEvent', 'EventCategory', 'EventAction', 'EventLabel']);

Homepage=Category , PretSmallBanJan2023Stars = Event name , Banner= Event label

e.g. - _gaq.push(['_trackEvent', 'HomePage', 'PretSmallBanJan2023Stars-CH', 'Banner']);

There are over 15k events like this that are on the current setup which I have to move before July, so if there is any way to keep the same setup and see data in GA4 it will be greatly appreciated.

Kind Regards

Upvotes: 1

Views: 1074

Answers (1)

Shila Mosammami
Shila Mosammami

Reputation: 1077

You have to consider that in GA4 there are no more Category, Action and Label. Follow This Link to move to GA4. Remember that there have been some major differences, as an example look at this Comparing metrics: Google Analytics 4 vs Universal Analytics. In order to define a Custom Event in GA4 follow GA4 Custom Events

In order to define custom events you can use two methods:

1 - GTAG

2- DataLayer

I believe it would be easier if you use the first one or gtag.js API to send info or events to Google Analytic API. However, it is subjected to change(so you might be obligated to change something or update something on and off when Google decides).

1 - GTAG

As it is described in this link Set Up an Event for Website Apps for GTAG,

Before you begin:

Create a Google Analytics 4 account and property Create a web data stream for your website Place the Google tag on your website It also assumes that you have the following:

Access to your website source code The Editor role to the Google Analytics account

To send events to Google Analytics this API has one function called gtag(), and whenever you want to send an event to Google Analytics, you use the following syntax:

  gtag('event', '<event_name>', {
    <event_parameters>
   });

Finally, if you need the same metrics Category, Action and Label I suggest you to create Custom Dimensions for these three. So if you have an old-defined table in your Database, it is not going to change the fields or create loads to the developers. The documentation for creating Custom Dimensions and Metrics is here. Remember that it takes 48 hours for GA4 API to recognise your custom dimensions. There are some limitations as well that you can read at the link above.

2- DataLayer

In this method, you need to work with GTM or Google Tag Manager, as well. To read more, you can follow this link GTM.

Upvotes: 0

Related Questions