jazzband/django-analytical

Google analytics Measurement ID Issue

taharushain opened this issue · 8 comments

I am getting an error when setting a Measurement ID for GOOGLE_ANALYTICS_GTAG_PROPERTY_ID as my project uses an App+Web property.

GOOGLE_ANALYTICS_GTAG_PROPERTY_ID setting: must be a string looking like 'UA-XXXXXX-Y': 'G-XXXXXXXXXX'

I think gtag.js inherently supports both features, and the test case for this should be fixed to take both strings.

Can you verify which change would be necessary to the django-analytical code? Ideally, you would create a PR for that.

Hi @bittner , I have sent in a PR, I believe fixing the regex should suffice.

Hi,

My GOOGLE_ANALYTICS_GTAG_PROPERTY_ID (Google Ads) starts with prefix AW-.
Would it be interesting to accept all standards?
The config actually accepts multiple lines:
https://support.google.com/analytics/answer/9310895?hl=en

Hmm... it might be time to drop the syntax check altogether. What do you think @bittner?

Probably.

(Frankly, I don't care, because I don't use Google Analytics and I would encourage everyone to stop using it, too. But that's a totally different discussion.)

What does Google's documentation say? Are there official patterns of valid ID's? If not let's make it simple for everyone.

To quote from the page @CleitonDeLima linked to:

Product prefixes for global site tags

UA Your global site tag is controlled by Google Analytics. The ID is your Google Analytics Measurement ID. To find the property associated with this ID, use the account search feature in Google Analytics. If the property does not appear, you probably do not have access to it.
G Your global site tag is controlled by a Google Analytics App + Web stream. The ID is your Google Analytics Measurement ID.
AW Your global site tag is controlled by Google Ads. The numeric string following the AW prefix is your Google Ads Conversion ID.
DC Your global site tag is controlled by a Floodlight tag. The numeric string following DC is your Advertiser ID.
other Your global site tag is controlled by a different Google product or may be implemented incorrectly. Use the Tag Assistant extension for Google Chrome to verify.

That "others" entry sounds especially ominous. 🙂

@bittner what do you recommend for analytics?
Considering the above shared quote by @jcassee , I am also of the view that the pattern check should be dropped all together but it also seems from this that G/AW/DC are valid prefixes while anything else (others) are probably invalid.

Let's first merge #164 and when the next tag type breaks it remove it altogether.