If I use the Google Analytics "GA4 setup assistant" tool to set up a new GA4 property, I get a new property ID. That property id is a 9 digit number with no prefix.
When I go to add this number to Drupal Google Analytics, it rejects it, saying:
A valid Google Analytics Web Property ID is case sensitive and formatted like UA-xxxxx-yy, G-xxxxxxxx, AW-xxxxxxxxx, or DC-xxxxxxxx.
If I look at the raw HTML Google wants to add in, it seems to have a "G-" prefix. But Google's UI really doesn't make this clear.
I've searched through the readme, I can't seem to find anything about this. This should be documented better.
Issue fork google_analytics-3323443
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
trevorbradley commentedOuch, add to this, that the value to put into this field isn't even the "Property ID". I can't seem to get Google Analytics working with GA4 unless I use the "Measurement ID". That actually has a "G-" prefix, but is a mix of characters and numbers
I can find that Measurement ID on Admin > Property > Data Streams.
I'm either doing something catastrophically wrong, or the documentation is highly confusing.
Comment #3
coozila commentedA valid Google Analytics Web Property ID is case sensitive and formatted like UA-xxxxxxx-yy. but google id is g-xxxxxxxxxx
Comment #4
petednz commentedCould anyone confirm the steps for setting up GA on D7 now that GA is giving out the G- rather than the UA - unclear if #2 is saying 'use the Measurement ID' and it works fine, or something else. Ditto unclear if #3 is a solution, or restating the problem. Thanks for any help that can be given to clarify this.
Comment #5
petednz commented... and apologies for jumping on a 4.x ticket when I am talking about D7, too many windows open :-) - hopefully the advice is the same anyhow if someone can explain the steps
Comment #6
Jaspreet-Kaur commentedHey @petednz
What kind of confusion do you have? I mean, you are confused about how to set up Google Analytics Code id on a Drupal 7 or do not know how to get the Google Analytics ID.
Clearing #4
“now that GA is giving out the G- rather than the UA“ - This means now Google Analytics provide us G- ID ([GA4] Tracking ID) because UA (Universal Analytics property, which will stop processing data on July 1, 2023)
Comment #7
petednz commentedThx for your speedy response. I am wanting to get Google Analytics set up for a d7 site. I have set them up previously when GA was giving out UA values. My understanding is they no longer provide this, but this module still expects them. Can I use this module with either the G- value or one of the others that it offers. I have tried them all and each time the module suggests I am not entering values that work.
Comment #8
Jaspreet-Kaur commentedGo ahead with G- ID . It should be unique and correct
Comment #9
petednz commentedPerhaps my GA is set up wrong in google.
Under Property Settings I see I have a Property ID which is a series of integers
and under Data Streams I have
- a Stream ID which is also a series of integers
- a Measurement ID. The latter is of the format G-XYZXYZXYZ
If i enter XYZXYZXYZ on a d7 site in the UA field for this module it responds saying
> A valid Google Analytics Web Property ID is case sensitive and formatted like UA-xxxxxxx-yy
Can you pls clarify where I am misinterpreting the instructions on how to apply a GA4 (G-ID) in a UA ID field?
Comment #10
petednz commentedPerhaps the answer needed to be that the D7 GA module at the time did not support this but does now via https://www.drupal.org/project/google_analytics/releases/7.x-2.7
Comment #11
Anonymous (not verified) commentedSHIROU FUJIMOTO made their first commit to this issue’s fork.
Comment #13
yospyn commentedAs tomorrow is July 1st and that's the deadline, can anyone clarify whether we use the GA4 Property ID or Measurement ID? My understanding is the Measurement ID is the correct GA4 ID to use with this module (NOT the property ID).
Comment #14
japerryThat is correct, the measurement ID (G- prefix) is what you should be using. Unfortunately I don't think there is anything we can change here as far as the module is concerned.
Comment #15
jaypanI've verified it is indeed the "Measurement ID" and not the property ID (an integer). It's a bit of a nightmare to find in the analytics control panel. Start with the gear at the bottom left, and started digging around for this ID.