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

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.

Related

Can I populate a custom dimension in google analytics from page metadata?

I'm trying to report on website performance for a website with editors in various UK regions (Eg. South-West, North, North-East) that don't map to regions that GA understands.
Is it possible to embed the region into the metadata of the page and then read that via Google Analytics as a hit for a custom dimension? If so how do I format the metadata tag on the page?
You can absolutely do this. On your page, below wherever it is that you have the Google Tag Manager script, you'll want to push your values into the data layer. I recommend something along the lines of the following:
<script type="text/javascript">
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
'uk-region': 'South-West' //As applicable
});
</script>
And then you'll need a couple of things in GTM in order to pick this up. First, create a new Data Layer Variable and populate the "Data Layer Variable Name" with the "uk-region" name I used above, or whatever else you want to identify it with. Give it a useful name like "uk-region" at the top.
In your Google Analytics page view tag then, you'll need to set up the custom dimension mapping. Click the box for "Enable overriding settings in this tag" and a dropdown will appear with "More Settings". Expand the "Custom Dimensions" and click the "+ Add Custom Dimension" button. Specify the number custom dimension you wish to populate under Index and in the value, we'll specify the variable we created with {{uk-region}}.
Test your container to ensure it's getting picked up as it should, then publish to commit the container to your website.

Use google tag manager install GA4 for SPA but the field page is not work

I use Google Tag Manager to install GA4 for SPA (single page application).
I search a lot of articles about setting SPA and it seems like I need to add a page field.
I tried to put the value as below but not one succeeded. I used Google Tag Manager debug mode to check the page view event was hit.
{New History Fragement}
{Page Path}{New History Fragement}
{Page Path}#{New History Fragement}
constant like /testGTM
custom javascript like below
function() {
  return window.location.pathname + window.location.search + window.location.hash;
}
Even I put the constant like testGTM, I still can not see the data contain testGTM. The page view data is collected but the URL is not the same as I expected. 
Did anyone meet the same problem? Or the field page doesn't work anymore.
Thank you.
Sample Setting GA4 in Google Tag Manager
I found out how to solve this problem.
First, click 「event」->「All event」.
Second, click「custom definition management」.
Last, click 「create custom dimension」and enter "page" in the parameter name.
After the above instruction, we can get the "page" data as normal.
How to Check
There are 3 ways to check
1.Engagement -> Event -> + custom(event scope)
2.Engagement -> Event -> click each event -> see past 30mins event's parameters
3.Engagement -> Event -> click each event -> scroll down to see parameter
P.S. I use the Japanese version so maybe the translations are different.

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.

Setting a Dynamic Macro in Google Tag Manager

I have two types Universal Analytics (UA) accounts: a rollup property ID that goes on all subdomains, and a subdomain-specific ID that only appears on that subdomain. There are a total of 7 subdomain properties.
I was wondering, instead of setting up 2 tags (ecomm transaction tag and the regular UA tag) for each subdomain/property - a total of 16 - if I could set up just those two tags and have the UA-ID dynamically changed for the corresponding property.
Example: set up the tag with the id as "UA-XXXXXXXX-{{UA ID}}" where "{{UA ID}}" is defined by me and set with a rule depending on what the current subdomain is. Somewhere - without asking the devs to create a new variable pair - have property one associated to "1", property two associated to "2" and so forth, so that the right tracker is fired on the right subdomain.
Thanks!
I did this via the following workaround:
I created a custom html tag that loads when the DOM is ready ( rule "{{event}} == gtm.dom)
inside that custom tag I put some javascript to determine the subdomain (or whatever dynamic property) and set a variable - let's call it "ua" - accordingly
inside the same tag I push the ua variable and a custom event to the datalayer :
dataLayer.push({
'ua':ua,
'event': 'INIT'
});
I created a macro "UA ID" that gets it's value from the push variable above
I created a rule "on init" ( {{event}} == INIT
I used that rule to fire all subsquent tags (so they would be executed only after the UA variable has been set)
So far (i.e. for the last 2 months) this is working rather well, so it might work for you, too.
Actually I think it will be a lot easier for you if create a lookup table with hostname as a base. Then just add the UA properties for all of your subdomains, each on new row in the lookup table. Afterwards you just use this lookup table as the variable for your UA:
It's a cleaner option to manage a lot of GA properties.

Resources