betaacid / expo-analytics

Google Analytics integration for use with React Native apps built on Expo
MIT License
286 stars 64 forks source link

Tracking ID vs Measurement ID #56

Open Simacho239 opened 4 years ago

Simacho239 commented 4 years ago

Hi all,

I'm currently trying to use this package to integrate and test some simple Analytics events.

Issue I'm struggling at the moment though to locate the right Tracking ID (TID) to use within a ScreenHit. I have a Measurement ID (e.g. G-XXXXXXXXXX) and Property ID (9 digit number) on Google Analytics, but using the debugging tool and checking the resulting link on this link testing site site it's returning an invalid TID.

Current usage of the package is (with the actual Measurement ID # used): const analytics = new Analytics('G-XXXXXXXXXX', null, { debug: true }); analytics.hit(new ScreenHit('Home')) .then(() => console.log("success")) .catch(e => console.log(e.message));

Any help is greatly appreciated!

amahajan87 commented 4 years ago

@ryanvanderpol

+1 on this issue.

I am facing the same issue. I have set up a web-app property on google analytics. I was unable to find the tracking id, instead I have property ID on google analytics.

I am using the following request:

const analytics = new Analytics('G-<9 digit property id>}', null, { debug: true }); analytics.hit(new ScreenHit('Home')) .then(() => console.log("success")) .catch(e => console.log(e.message));

When validating the hit on the debug tool,

I see the following error:

Hit is invalid!
The value provided for parameter 'tid' is invalid.
The value provided for parameter 'sr' is over the recommended limit.

What is exactly wrong or that I am missing.

habeebtheprogrammer commented 4 years ago

same issue here. :(

arnaud-cortisse commented 4 years ago

I was able to find it here: image

In Google Analytics: Admin / Account User Management / Tracking Info / Tracking Code

BillyCottrell commented 4 years ago

@Simacho239 @amahajan87 @habeebtheprogrammer pls read the following text in the readme file at: Support for web + app projects.

This text states that expo analytics only works when setting Google Analytics up for website and not for mobile since mobile will provide an id that starts with "G" and is not supported. Also screenhits do not function at the moment since this library does not work with the mobile setup of Google Analytics.

Please do not think that this library does not work with mobile apps, because it does except Google Analytics can't be setup for mobile but only website.

I hope that I have explained this correctly and understandable for you all!

PiyushOnline commented 3 years ago

@Simacho239 FYI

GA4 property has Measurement ID only GA3 property has tracking ID only

You can not have both! If you see one you'll not find the other in same property.