Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google Analytics App + Web support #48

Open
wscourge opened this issue Aug 29, 2019 · 21 comments
Open

Google Analytics App + Web support #48

wscourge opened this issue Aug 29, 2019 · 21 comments
Assignees

Comments

@wscourge
Copy link

Is there any way to use this package for Google Analytics App + Web?

As for now, all I can see in docs is initializing like:

const analytics = new Analytics('UA-XXXXXX-Y');

where 'UA-' part strongly suggests that it's dedicated for Google Analytics Web; the Tracking ID equivalent in the App + Web property is called PROPERTY ID, and it is not prefixed with 'UA-'. As far as I've seen to this point, those property identifiers are 9-digits.

I have tried passing the aforementioned property id as an argument to new Analytics(property_id) constructor with no avail.

Is there anything I'm missing here, or is it common just to treat the Android / iOS app as "Web" in Google Analytics?

@StefKors
Copy link
Contributor

StefKors commented Oct 2, 2019

This should be supported and documented in the readme. for example my tracking code used G-XXXXXXXXXX

@StefKors
Copy link
Contributor

StefKors commented Oct 2, 2019

I've added some readme updates for the time until this issue is resolved.

@ryanvanderpol
Copy link
Member

Thanks for the discussion here. I've never used the new App + Web property type, and don't really have a project to test this with. If someone wants to play with it and submit a PR I'd happily merge it in!

@nsdub
Copy link

nsdub commented Jan 24, 2020

I'm still unclear on what the guidance here is @ryanvanderpol. For example, our property ID is in the format 123456789. Is the correct way to initialize like this:
const analytics = new Analytics('123456789');

Or like this (with the 'G-' prepended):
const analytics = new Analytics('G-123456789');

FWIW neither work for us, but perhaps this is due to the delay in Analytics reporting?

@ryanvanderpol
Copy link
Member

@nsdub When you set up your Google Analytics account, did you choose the new "Apps and Web" option? or just the "web" option? See this article for an explanation of the difference.

I haven't done it myself, but my guess is choosing the "Apps and Web" option creates the G- property ID, which seems like it doesn't report the same way as the UA- properties. If that's the case, the guidance here is to create the Google Analytics account using the "Web" option.

Also, there is definitely a delay in data showing up in the GA reports (in my experience, about 30-120 minutes), however the "Realtime" tab should show data immediately.

@nsdub
Copy link

nsdub commented Jan 24, 2020

@ryanvanderpol We were migrated to the new "App + Web" option via Firebase. I just created a dummy "App", (yes, app only) property and that also has the same property ID format of 123456789. Our Web property has the UA- format. Not sure where the G- property ID came from. Perhaps it's legacy.

I should also clarify what I mean by "not working" -- it's purely that the events don't get reported to Analytics. There doesn't seem to be any issue with initialization nor is an error being caught when an event is created. For instance...

analytics.event(new Event('dummy'))
        .then(() => console.log("successfully logged dummy"))
        .catch(e => console.error('uh oh...'));

...will log the success message.

I'll continue playing with this today, including trying to use the Web property ID within the app. Will report back with any new learnings

@nsdub
Copy link

nsdub commented Jan 25, 2020

So UA- properties work as expected which makes sense because it looks like you built out this package with the Measurement Protocol. However it doesn't seem like the "App + Web" type works with the Measurement Protocol. I can't find any official documentation that explicitly states this, but it's suspect that the devguide isn't updated to make mention of "App + Web" and this blogger says that "App + Web" doesn't have anything that supports HTTP requests.

@StefKors were you able to get this package to work with your "App + Web" project?

@nsdub
Copy link

nsdub commented Jan 31, 2020

Since it looks like this thread is dying, I wanted to provide an update to the path that we chose:

Our use-case was that we wanted to log Analytic events so that we could use them in our AdWords campaigns as conversion actions. Our app uses Firebase but the OOTB conversion actions you get with Firebase (like app installs or first opens) weren't useful for the campaign optimizations we wanted to run. We decided to implement the Expo Branch package, create custom Branch events, import those events to AdWords (as a third party analytics provider), then set them as conversions.

@lobobabysaurus
Copy link

Looks like App + Web requires the V2 version of the Measurement Protocol to be used. Looks hard to find google documentation, but found a little guide here -
https://www.thyngster.com/technical-overview-of-new-appweb-properties/

Would folks be against me trying trying to dynamically change the version of the api used based on id?

@lobobabysaurus
Copy link

Also a link to a question posed directly to Google Analytics about proper v2 docs https://support.google.com/analytics/thread/17485766?hl=en

@ryanvanderpol
Copy link
Member

Thanks for the research, @lobobabysaurus. I don't currently have an active project that I can switch to the App + Web protocol, but I'd happily review and merge in a PR if we can agree on a good way to support it without breaking existing users.

@lobobabysaurus
Copy link

How about a new member for the options constructor arg that drives the version that can fall back to 1 if it isnt being specified? That way it is backward compatible and Web + App consumers just need to explicitly opt it

@ryanvanderpol
Copy link
Member

@lobobabysaurus that sounds good enough for me!

@lobobabysaurus
Copy link

Looks like Web + App is intrinsically tied to event streams in Firebase, which is partially why the HTTP endpoints don't work the same way. Not sure how to resolve without pulling in native Firebase rigging

@calendarbudget
Copy link

With the announcement of Google Analytics 4 (new name for App + Web), is there any update on this?
https://support.google.com/analytics/answer/10089681?hl=en-GB

@john-landgrave
Copy link

Just pinging for an update on @calendarbudget's comment above? Is there support for GA 4 ids now?

@danielyaa5
Copy link

+1

@theamanjs
Copy link

Looking forward to GA4 support in the package. Is there any idea when it will be out?

@djaenike
Copy link

Still lurking this thread - any updates? I believe GA4 is replacing UA eventually so it seems pretty important this gets resolved.

@Sir-hennihau
Copy link

still waiting for an answer, it is pretty unclear how to setup properly right now

@matchstickdevs
Copy link

Any updates with this? Universal Analytics are being sun-setted on July 1st (in 4 days)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests