Custom Dimensions in Universal Analytics firing multiple times - google-analytics

I'm not sure if this is an issue or not, but any clarification would be very helpful.
Every time there is a separate event on a page the custom dimensions will fire again (they are first fired during the pageview tag).
On the order confirmation page each custom dimension I have set up for that page is sent at least 4 times. Once on the pageview tag, once for the Event I created, once on the transaction tag and once on the Item tag.
I guess if you are looking at your custom dimensions at a visit level it won't matter but if you are looking at pageviews or hits of the custom dimension this might be an issue.
Does anyone know if this is actually an issue?
Thanks,
Frank
code looks like this:
ga('create', 'UA-11111111-1', 'mysite.com');
ga('set', {
'dimension1': Value1,
'dimension2': Value2
});
ga('send', 'pageview');
ga('send', 'event', page type,'Stage x',value);
ga('require', 'ecommerce', 'ecommerce.js');
ga('ecommerce:addTransaction', {
'id': order id,
'affiliation': '',
'revenue': revenue total,
'shipping': shipping cost,
'tax': transaction tax
});

Do you set the value with ga('set'...) ? If so you could try alternative syntax:
ga('send', 'pageview', {
'dimension1': 'My Custom Dimension'
});
However if the dimensions are session- or user- based it does not IMO make a difference. If they are hit based it depends on what you want to do (e.g if you want to filter/segment events based on hit level custom dimensions you need to send them along with the event, so it is not just a cosmetical difference).
EDIT
Looking at your code - yes, this is expected behaviour, you are setting the dimension for all subsequent calls. It is not an issue as far as data limits are concerned (custom dimensions do not cause additional interactions). So, not a problem, you will have to decide if you think you need the data (i.e. can your custom dimensions reasonably applied to an event), but even if you don't there are afaik no technical concerns with sending it anyway.

Related

Track Custom event using Google Analytics

I am trying to track user feedback onclick of thumpsUp(1) or thumsDown(0) : with help of GA but not able to track the events in the Analytics Dashboard as shown below.
window.ga("send", {
hitType: "event",
eventCategory: "button",
eventAction: "feedback",
eventLabel: pageID, // page url
eventValue: value, // 1 or 0
});
}
custom event is not appearing below:
I am able to get events :
Is it possible to map vote and pageID together so that we can know which page has which vote
Many Thanks
The code shown is for Universal Analytics but dashboard is on GA4.
They are 2 different things.
You can find code to setup GA4 events in the documentation: https://developers.google.com/analytics/devguides/collection/ga4/events?client_type=gtag
To understand who clicked on up/downvote you can use the parameters associated with the event:
https://developers.google.com/analytics/devguides/collection/ga4/event-parameters?client_type=gtag
Note: the data in the GA4 platform (unlike UA) are visible after 24h.

Google Tag Manager tracking drop down menu/list (Web app built in R-Shiny)

I have a R Shiny app that I have connected to Google Analytics using Google Tag Manager (R Shiny app means AJAX website). I am currently tracking the standard stuff like PageViews, and have set up a tag to track which Tab a user clicks on (Using Click Element).
In most tabs, I have a drop-down menu/list (can be seen in the picture). When clicking on this list to select/change the input, the click element does not fire. So clicking does not work here.
In the same picture, I have included the source html code. I highlighted what I think is important. The default input is "Age Group (Discrete)." The "option value=" and "selected" changes the input (changed to "Pyramid (Discrete)"). And it also changes in the div class="item" data-value=..." line.
I do not know how to capture when a user changes the input using Google Tag Manager. I am however able to successfully track this if I put this GA code in my JavaScript file.
$(document).on('change', 'select', function(e) {
ga('send', 'event', 'widget', 'select data', $(e.currentTarget).val());
});
But the above only works if I also have this included:
ga('create', 'UA-######', 'auto');
ga('send', 'pageview');
Which means it is double-counting pageviews (tracking page-views on GTM and the GA code above).
I prefer to track what I want using just GTM. Any help would be appreciated. Let me know if the image is hard to see (May need to zoom in). Thanks
one possible solutions is using GTM custom events:
1) adjust your code to trigger custom event instead of sending GA event:
$(document).on('change', 'select', function(e) {
dataLayer.push({
'event': 'widget data selected',
'selected_value': $(e.currentTarget).val()
});
});
This will trigger specific widget data selected select that can be catched with Custom Event Trigger. Then just use that trigger for your regular Analytics Event GTM tag.
Additionally, you might set up user-defined Data Layer variable to read the selected option value from dataLayer and use it in your tag.

Showing (custom) dimension as percentage in Google Analytics

I'm setting up a custom dimension "Area" (or similar) with the possible values "HQ", "Store", "Other" ... so far, all is good. This data is tied to the actual pageview.
For the record, it's done through the equivalent of the following snippet:
ga('send', 'pageview', {
'dimension1': '...'
});
Following this, in GA, I want to review the page views for a certain URL, and see something to the effect of:
Results for /hello-world
Area Percentage [more columns?]
HQ 45% ...
Store 35% ...
Other 20% ...
Is it possible using standard GA configuration? How can it be done?
Actually, it's this simple... there's a pie chart button on the page views page (or view?), just click that and select your secondary dimension. Done!

google analytics reading the report - click event detail?

I'm using google analytics and am using this code as an example to capture a click event.
ga('send', {
'hitType': 'event', // Required.
'eventCategory': 'button', // Required.
'eventAction': 'click', // Required.
'eventLabel': 'nav buttons',
'eventValue': 4
});
where do I find this data in the reporting?
what I am able to find is event catgory buton but I cant find where this button was clicked with eventValue 4.
Can you please help.
I'm pretty sure that you misunderstand what "event value" means - this is to monetize non-ecommerce events. Which means event value is a metric, which in turn means that the values for multiple events will be added up.
So, the only case where you could possibly see the value "4" is when you isolate one single event. Else you will see a total (or average) for all events with the selected category/action/label (depending on the report).

Visitor Custom Variable Google Analytics Help

I am using Google Analytics Custom Variables for a site I am working on. Here is the code snippet uploaded on the page.
_gaq.push(['_setAccount', 'UA-xxxxxxxxx-1']);
//]]>
</script>
<script>
//<![CDATA[
_gaq.push(['_trackPageview', 'searches/new/registration/complete']);
_gaq.push(['_setCustomVar', 1, "member type", "registered", 1]);
_gaq.push(['_trackEvent', 'registration', 'signup',,1]);
Although I am aware that the _trackPageview needs to be placed after the _setCustomVar call, I am still seeing numbers flow through into Google Analytics as 'member type=registered'. I do not want to dismiss these numbers and I want to make some sense of it before I amend this error in how the snippet was placed.
Any reason why I stil received visits for this Name-Value combination?
Thanks -
The Custom Var is set with a GA cookie, and is actually stored and sent on your next _trackPageview, that's why you can still see it, all you are doing to sending the data probably in a moment you don't want to (the next pageview).
Edit: Also as pointed out, it could go with your _trackEvent method, wich will end up doing the same thing, sending the data in a particular time you dont intent to, specially with events, wich are linked to interactions, so if no one triggers those in the page you are trying to set the customVar, it wont get set at all.
Because your custom variable's scope is set to 1, it'll still get fired by "trackEvent" (even without "trackPageview".
If your scope was set to 3 (page-level), it will then rely on "trackPageview" and will not register well with "trackEvent"

Resources