I'm trying to use google analytics to track custom events, but when I try to hit the page:
http://www.google-analytics.com/collect?v=1&tid=UA-myUA&cid=1111&t=event&ec=Movement&ea=livingRoom&el=desk
It opens the page like collecting, but in my analytics account, it doesnt show any event....
You'll want to track Google Analytics events using Google Analytics event tracking - https://developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide
You can implement event tracking using Google Tag Manager where you can create you custom events. The procedure is easy to implement than traditional Java Script code as it does not require developer to implement GTM.
Simply follow the below steps for GTM implementation:
1. Log into Google Tag Manager
2. Select “Tags” from the left-hand side
3. Create a new tag
4. Select Universal Analytics from Tag Type
5. Set your Google Analytics Tracking ID
6. Choose “Event” for the track type
7. Set your Event Category, Action, Label and Value as desired*
8. Set your triggers as required
You can refer Google Guidelines for detailed information.
Related
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
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.
I have created 2 events with same name 'purchase' for universal analytics and for GA4 but the monetisation report is not correct in both the dashboards.
How can I create purchase event for both Universal analytics and GA4 and show the correct transactions in the report?
Also Can I create custom events like order tracking with product(item) parameter like purchase and create a custom report with all the parameters in the GA account?
Are you using a datalayer push for the ecommerce data that you want to display in your Analytics?
Or are you using dynamic values that you scrape from your website with custom javascript variables?
In any case, you have to include the correct structure in an event for the correct report to work.
I would recommend building a correctly formatted datalayer.push event that corresponds to GA4 standards.
For example:
How a purchase event should look like: https://developers.google.com/analytics/devguides/collection/ga4/ecommerce?client_type=gtm#make_a_purchase_or_issue_a_refund
Required and optional event parameters: https://developers.google.com/analytics/devguides/collection/ga4/reference/events?client_type=gtag
Then you can use a GA4 event tag to capture ecommerce data from the datalayer, and the UA tag has a checkbox that enables it to process GA4 data found in the datalayer.
This approach means that you will only have to support one type of Analytics structure on your website while you get ecommerce reports for both platforms.
I have Google Tag Manager account created,
And I have Google Analytics account created,
Inside my app I only have GTM included, and after some research, I managed to connect my Google Analytics acc with GTM to track page views.
Now, what I used to do before with just using GA, I was using some custom events inside my app,
So ga('send', 'event', 'Videos', 'play', 'Fall Campaign');
Now I tried to do the same after GTM is connected but I'm not getting any events inside my admin
I also tried doing dataLayer.push with same event arguments and event is still not showing up
Does anyone have an idea of what I'm missing to get custom events working?
Also, I don't want them to be defined inside GTM (that would mean that for every custom event I need to create a trigger if I get it right)
Is it possible to just publish them without any configuration inside GTM?
Thanks!
You have to create Analytics Tag (type event), Trigger and some dataLayer Variables, you can find the guidelines here: https://support.google.com/tagmanager/answer/7679219?hl=en
I'm having problems getting my Google Analytics tags to fire correctly.
I'm using the Google Analytics Settings variable type, but my tags don't fire unless I override the Analytics ID on my tags, and it's just a pain.
Here's what I have done:
I have created a Google Analytics Settings variable and set it up with my Analytics tracking ID (I've made sure there are no whitespaces around it the id)
I have created a Google Analytics tag and referenced my settings variable like this.
Now when i visit my webpage with the GTM script and fire the related trigger, nothing happens.
But if I override the tracking ID with the same value that is used in my Google Analytics Settings variable like this:
and fire the same trigger as before, my tag fires just fine, and my events are tracked.
The text says "Inherited from settings variable", so I'd expect everything to work without overriding anything.
Does anyone have an idea?
This should work. I think your actual GA variable is {{CONST - Analytics ID}} instead of the other one.
In your case use {{CONST - Analytics ID}} instead of {{Google Analytics - Basic settings}}.
I have managed to set up Google Tag Manager to fire off events to Google Analytics when links are clicked on different pages of my websites. I know it works as when I click the links, an alert shows up in Real Time --> Events section of Google Analytics.
I was wondering how to implement the following: For each page on my site I would like to see in Google Analytics the conversion which I define to be: Number of Relevant Links clicked on Page / Number of visits to Page. The numerator in this instance being whatever came from Google Tag Manager.
Thank you.
You are tacking about metric, not conversion. For conversion tracking you have to define exact value.
To track such metric you can use calculated metric with a formula X/Pageviews, where X is can be number of events (link clicks in your case).