Use hits sent by GA4 in Google Tag Manager to get events parameters - google-analytics

does anyone know if it is possible to use the parameters of an event sent with the hits of the event itself from Google Analytics with the Google Tag Manager?
page_view hit details
As you can see from this screenshot, the page_view event includes many parameters, such as Page Title, Session Engagement, and many others that are not natively tracked by GTM.
For example, if I wanted to get the value of the "seg" parameter via GTM, how can I do it?
Thank you
I tried using a custom JavaScript but I don't know how to use it

You cannot. GTM doesn't give you the ability to monitor network requests. Even though you may be sending the request via GTM to GA, it's not going to show you the request details or the response.

Related

how can I validate if good analytics is counting review with ajax request

I have installed the google analytics in our e-commerce site using google tag manager. From the product detail page you can click on the colors to see the same product in the different colors. I implemented this using ajax so the page load is not required. I was curious if the google analytics will count as multiple reviews a user clicks on the different colors or do I need to explicitly call something in order for the GA to count as multiple reviews.
First of all, that depends how and what kind of GA you've implemented.
To implement analytics, you have to specify a trigger for the analytics tag. That trigger normally determines if a tag is fired or not.
If you used a page load trigger, then the tag will only be triggered on the real page load. And it won't be triggered on your ajax manipulations.
With only one exception: if you used the GA4 config tag, you had this checkbox there:
The checkbox doesn't only send the pageview on config load, it keeps sending pageviews on every history change. Therefore, if your ajax causes history change and you use the GA4 config tag, then you're getting pageviews.
But this is theory. You can just go and check. Open your network tab, filter the request by collect and see what's sent when. Or alternatively, install the adswerve datalayer debugger and it will log whatever is sent whenever it's sent into the console in a very neat, clean way. This is how it works on this page:

Is there any API call or any kind of feedback to know whether data is actually sent through google analytics collect endpoint?

I have settled my google tag manager as from the guide.
I have got in place a page that redirect just after the tag gtm-load is collected into the dataLayer. It's actually a "transition" page that should redirect instantaneously.
In this way I make sure google-analytics.com/r/collect is called, as I can see from the network ta of my browser, seems the only way to do so for an "instant redirect page".
However I need to test it from the back-end side.
Is there any way to have a feedback from Google Analytics about the data is actually sent? For example something like google-analytics.com/get/data/lastEntry, so that I can use a restAPI to check it out?
As far as I know, google analytics provide only metrics through a web page, and no actual data sent to.
Moreover there are some Rest API here but they are only for configuration purpose.
you might pass a JavaScript function as a hitCallback parameter of analytics send command and it will be called right after hit data were sent:
https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#hitCallback
Here's an example of how to use it with GTM alongside another useful feature of eventcallback
https://www.simoahava.com/gtm-tips/hitcallback-eventcallback/
Hope this helps.
There is a realtime API in Google Analytics, so what I have done for testing is to call my test URL with utm campaign parameters attached. Then I made a call to the realtime API and filtered by my custom campaign.
The realtime API is fairly limited (no session based values, obviously, you cannot test custom dimensions etc), but at least this tells you if your hit has registered in GA.

Google Analytics Measurement Protocol events sent via REST API are not seen on the dashboard

I am trying to use the Google Analytics Measurement Protocol to record some events happening on my server-side code. I am using the REST API as suggested here but I don't see any events on the Google Analytics dashboard.
When I try to add the event via the Google Analytics Hit Builder, then I am able to see that event in the dashboard.
I don't think any authentication is required while using the REST API and only a correct tracking ID is required which is present. I have confirmed that the POST request is not failing.
I am looking at the Realtime > Events to check whether the events are pushed or not. Is there a place where I can check the historical data to see if the events are present there.
Thanks!

Google Tag Manager - firing events from rest api

Some of my events are getting fired from frontend for both google analytics and facebook pixel and they are getting captured properly through GTM.
but now i have a functionality which is getting done from cron and is served from backend. I need to capture a event in both google analytics and facebook pixel when this is getting captured.
We need to fire the https (rest based) calls for capturing this.
Kindly help on this how this can be achieved.
Update: While this was correct at the time of writing, Google has since introduced server-side tagging via GTM, which conceivably can be used for server-to-server communication.
--
GTM has no serverside API to trigger tracking calls (the GTM API is for managing tags that will be wrapped into a Javascript function. There is no tracking backend to do calls against).
You need to send your calls directly to GA via the measurement protocol or respectively to Facebook via offline conversions.
Yes you can.
create an event listener on button click to connect to the API to collect the data
then with an event push the data you want to a Datalayer
and then use it as you wish.

Google Tag fires but not logged in Analytics

I had set up my Google Tag to track clicks on spans with certain IDs, the events are firing according to WASP extension, but they are not showing up in my Google Analytics account.
Here is my trigger:
My Tag:
WASP in action:
GA displays pageview only:
Code is installed properly
Sorry if this seems pretty obvious, but in Real Time you should be on the Events tab, and it seems you are looking in the Content tab. Events are never displayed there.
While the configuration looks to be correct, remember that events won't show up in your standard reports until the data is processed, which takes about 24 hours. As long as the hit is showing up in your Real-Time reports, then you shouldn't have any issues.
Can you please post full HTTP request? For instance from Charles Web Debugging Proxy of Live HTTP Headers extension or anything simillar.
What you post seems to be correct as #nyuen says!

Resources