Track Custom Dimension on Google Analytics 360 with GTM on Hybrid App - google-analytics

I want to track the push notification consent (opt-in) in Android and iOS with GTM and GA360. I have already created a custom dimension on GA360. Then, I created a variable with an Event Parameter. However, I am not sure what I need to add on the Event Parameter Key.
Then, I created a tag in the following way:
With the custom dimension from GA360:
Is this correct? Or am I doing something wrong?
THanks!

Related

Is the Google Analytics "UA-" prefix gone for properties

I just created a new property in Google Analytics and was looking for the property ID, in this format: UA-xxxxxxx-y
I can only find a number 9 digit number.
Is the format changed since Google Analytics G4?
I'm following this guide and I'm looking for the Tracking ID they mention: Setmore Setup Guide
The Property creation process now defaults to GA4 (formerly known as app+web) Properties.
If you want to create a Universal (formerly known as web) Property,
goto the Admin page where it lists your GA Account and the existing GA4 Property.
Click the +Create new property button at the top of the property column.
Once on the new Property Settings page, select the blue link Show advanced options to see and toggle on the Universal property options.
Select create Universal Property only.
Then click Next and complete the Property creation.
You will then be able to access the Universal gtag.js tracking code snippet via the Tracking Info section in the Property column and your UA-XXXX tracking Id will be on the top of the Property Settings page.
Google Analytics 4 doesn't have property ids it has MEASUREMENT_ID which is just a 9 digit number.

Custom Dimension value alway showing up as not set

I am trying to create custom dimension using GTM, dataLayer and GoogleAnalytics.
In GTM, created a user defined variable.
UserVariable
I have something like this in my html page
<script>
function addCategory(){
dataLayer.push({
'category' : 'drama'
}
);
}
</script>
</head>
<body onload="addCategory()">
In Google analytics created custom dimension
Custom Dimension
In the GTM in tags section, associated the dimension that was created with the user defined variable.
Index - 2
Dimension Value - {{category}}
In the Preview and Debug mode i can see that value in the Variables section.
category Data Layer Variable string 'drama'
But in Google Analytics i always seeing that value as (not set).
What have i done wrong
Any custom definition should be sent with an existing hit. Can you confirm that a pageview or an event is fired after you defined the variable? Check this answer that is describing how to send a custom dimension with GTM. In step 3 it is described how to use the Universal Analytics tag to send the custom dimension to GA. I suspect that your custom dimension is never included in an analytics hit that is why you see (not set).
Also, I would advise against using variable names such as 'category' in GA because it is resembling a variable 'used' by enhanced ecommerce.

Value is being sent to datalayer, however, the custom dimension is not being caught in Google Analytics

I am experimenting with getting datalayer variables into GA. I am just experimenting so the values are just for testing.
So I paste this link with a datalayer push onto a page:
<a href="http://www.google.com"
onclick="dataLayer.push({
'test': 'okay'
});">Customize Color</a>
I do the necessary configuration in GTM as well as GA.
However, in the debug console of Chrome I get this into the datalayer:
However, this doesn't come into GA custom dimension as you can see below:
One small note, if I paste the datapush directly under the datalayer script, I get the datalayer variable in the custom dimension. However, in that case I do not have a onclick with the URL.
What I suspect could be happening is that there is a misalignment when that dataLayer push is being made, and when you are grabbing the value to populate your custom dimensions. You should push an event ALONG with the CD value:
dataLayer.push{(
'event': 'someEvent',
'test': 'okay'
})
and then you should trigger your event tag to fire on the someEvent trigger, and at the same time, populate your CD with the test value.
EDITS:
Your trigger should be simply this:
There is absolutely no need to define an event variable that's used in an eventTrigger that fires on someEvent. I believe doing it that way causes issues.
Nyuen, great, that was exactly the issue! I didn't see the VALUE of the first declared variable of the datalayer_push also having to be the name of the custom event. I was constantly pairing it in the condition section.... I still don't see the logic of it, but ey, it works! Many thanks!

Universal Analytics tag with custom event and custom variables

I want to create a Universal Analytics tag (with enhanced e-commerce enabled) in Google Tag Manager, firing on custom event, ex.: uaEvent with two custom variables, ex.: uaVar1 and uaVar2.
I already created Data Layer Variables (uaVar1 and uaVar2) and the custom event trigger uaEvent in my GTM container. I'm pushing following data:
dataLayer.push({
'event': 'uaEvent',
'uaVar1': 'value',
'uaVar2': 'value'
});
and firing uaEvent on form submit.
Question
How should I configure my tag in Google Tag Manager container so that 'uaVar1' and 'uaVar2' will be visible and connected to uaEvent in Universal Analytics panel ?
Custom variables have been deprecated in Universal Analytics, so you should now use and configure Custom Dimensions under the Properties column in the GA interface. You will need to define the index and scope. Once you have done that, then for the tag that you want to associate your custom data with in GTM, you will need to specify, under the Custom Dimensions section of that tag, the name of the dataLayer variable for your particular Custom Dimension as well as the index.

Custom Dimension in Google Analytics not showing in my queries

I am using a Custom Dimension to send my internal UserId to GA. What we need is to know which users are clicking on this button. But when I try to get reports using the Category and Event for this button click, and I include my dimension on the report, it won't show any result.
But, if I only request eventCategory or eventLabel, it will show for example 2 hits. Which is weird because I am sending the dimension value with each click event that I am tracking, and seems like I don't have values for this specific event.
How can I make sure I have information in GA for this event?
I had the same problem. You need to set custom dimension index on your google analytics console.
Once you login into your google analytics console, go to admin tab.
At bottom of the middle column you can see Custom Definitions.
Click on Custom Dimension under Custom Definitions and define Custom dimension name for your custom dimension index. Default scope is for hit, if you want that for session change the scope.
This is all for V4 version of the analytic.
Please try this code:
GoogleAnalytics analytics = GoogleAnalytics.getInstance(YourActivity.this);
Tracker tracker = analytics.newTracker("TRACKER ID");
tracker.setScreenName("SCREEN NAME");
tracker.send(new HitBuilders.AppViewBuilder()
.setCustomDimension(1, "VALUE")
.setCustomMetric(1,1)
.build());
Here is 1 in custom dimension and custom metric is the index.

Resources