We are trying to pull Google Analytic tracking data using GA 4 API. Looks like page view events don't have userEngagementDuration value. it is always returning 0.
Ex. In universal analytic, we usually have
"metrics":[
{
"expression":"ga:timeOnPage"
}
]
it returns the page duration of the user on the page. Similar to this in GA4 for page_view, we want the duration. equivalent of ga:timeOnPage in GA4 is userEngagementDuration. But this is coming as "0" even we stay on the page for quite some time.
Is there anything we are missing here? This pageview has coming auto by making it enable through GA configuration.
Regards
Pravasini
Related
I've created a view in Analytics that filters based on dim1 being "true". For context, the trigger in GTM fires when the window is loaded since the dimension value is being set by a custom JS variable that needs the page to finish loading.
In tag manager assistant I receive no errors and I can see that my custom dimension is set but it doesn't show in Analytics when I filter based on the value.
I read elsewhere that sometimes custom dimensions can take a day in Analytics to show. It's been a couple of days though and I am at a loss. What else could I be doing wrong?
How to do event tracking and send data to Google Analytics without creating a Goal in Google Analytics.
e.g. If I have 6 image links on the homepage, I want to do event tracking and send data to GA that how many people clicked on which image/category. But don't want to create goal for it.
As long as there is tracking code attached to your image, you can see events at Google Analytics at Behaviour -> Event -> Top Events, there you will be able to see reports by event category / event label / event action. You don't need a goal to achieve so.
I've created a new view in Google Analytics with everything set up the same as a currently functioning one, only with the addition of User ID tracking turned ON. It's using the same property so the UA code has not changed.
I've copied over everything that I can think of from the current view to the new view. At first glance everything was working fine, page views were coming through via Real-Time correctly and matched up with the values seen in the current view.
For some reason though, the new view is not listing ANY actual events in Real-Time, however the events graph is being populated.
The current view IS tracking all the events correctly.
We use Tag Manager to handle all our events among other things, and using the debug mode, all events were also being triggered correctly. Finally, I've also used the GA Debugger chrome extension, which again is not showing any issues. The new User ID property is being passed through to analytics as I'd expect.
I've tried searching for any issues related to User ID views and tracking events, but came up blank, presumably because there is no inherent issue with this set up.
Any suggestions?
I found out that the reason that the events were not tracking is because the user id was not being sent along with every event.
I believed that once it was set on page load every analytics interaction after that would use that user id. This was not the case. In Tag manager I added a 'Field to set' property for all relevant tags like so;
The typical situation I'm dealing with is an ASP.NET form page (generally an opt-in or sign-up form) that posts back to itself when the user hits submit. By default, Google Analytics will track both of these views as the same page, so it's not possible to detect which visits are the initial view vs. which are the "success" view.
In the past, I've dealt with this in one of two ways:
Using Event Tracking to track form submission as an event. This works fine, but in GA you don't see this metric in the same place as you see the initial page views.
Dynamically adding a querystring to the form's action attribute so the resulting pageview actually shows up as a different page in GA. This feels like a hack, but I like the way the data shows up in GA.
Is either of these approaches preferable, or is there a better way to do it that I haven't thought of?
Have a look at virtual pageviews, using them you can make GA think of any event like it was a pageview with the URL you specify.
For example, if I have a news page that's already being tracked via GA and I add a javascript event to capture clicks on a specific link to the news page (e.g. navigation) am I then 'double counting'?
If a fake pageview is not beneficial in this situation, and from your description that you're looking to track an engagement click on your page, use Event Tracking instead of Pageviews.
Tracking a click/event is easy (especially if you're already using Javascript). The best part is that this event is not considered a page view, keeping those stats safe.
The implementation is simple and allows for quite a bit of customization:
_trackEvent(category, action, opt_label, opt_value)
Below is an example of a link that's been encoded with an event tag:
Play
Here's the Google Analytics resource page on Event Tagging:
http://code.google.com/apis/analytics/docs/tracking/eventTrackerGuide.html
Well it's not a real page view, but Google Analytics thinks that it is--i.e., it shows up in your pageview counts.
Fortunately, it's easy to filter those so they don't contaminate your pageview data.
So for instance,
_gaq.push(['_trackPageview', 'unique_virtual_pagename']);
So in your GA Browser, you'll see the number of clicks actually shown as the number of pageviews of *unique_virtual_pagename*, which is not good.
There are a two ways to fix this (that i am aware of): (i) set a temporary filter at the bottom of the pageview table; or (ii) set a persistent (c*ustom*) filter in your Admin Panel (which i think is best) to remove pageviews having only the name *unique_virtual_pagename*, or whatever name you've chosen. This will of course take up to 24 hours to set, so the best plan is to set the filter first, then add the javascript to your page. so the filter is active when you begin collecting clicks.
But that just solves the problem of disaggregating these virtual pageviews from your real pageviews, you still need a way to count/record them.
I prefer to create a separate profile in these cases. So first, i filter the virtual pageviews from my actual pageviews using a custom filter, then i create a new profile which has another filter excluding everything but these virtual pageviews. I usually give that profile a name based on the event.
What you're doing is registering what's called a 'virtual page view'. To GA it's seen as a real page view and shows up in your content report's and page view counts etc. This is often useful if you want to show a page view for media that GA can't track. It's also commonly used to count an event, such as a button click, as a goal conversion.
If you just want to record the event and not count a page view you should look at using GA event tracking instead.