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
Adds support for GA4 properties and load gtag.js
instead of analytics.js
#107
Comments
Turns out, if I am not mistaken, with the new |
Based on my research, most of the Universal Analysis (ga) functionalities work with gtag. The syntax is different. For example, adding custom dimensions: In
In
Universal Analysis properties' tracking ID starts with However, GA4 and UA properties use fundamentally different way to track user interaction. Also some of the This is a nice library. Happy to create a new PR and help add a new type of plugin like |
Yeah happy to take contributions on this update. A couple of questions
Thanks for bringing this up. I missed the GA update announcement |
This is not breaking current implementation of GA, but when creating a new property on google analytics, the GA4 property is now the default way. We can still create a "hybrid" version that is creating a universal analytics property along with a GA4 property though (for now). They seem to want to push to upgrade to GA4 in general anyway, including existing accounts I guess. |
You have to use
I don't think it matters if it's server or client side. If the property type is GA4, you have to use the
I don't know too much about how that works. I've never used it, but my assumption and based on this answer, if the property type is I'll work on adding a new type of plugin soon. I'd only have time during the weekend for this. If you haven't heard back from me in three weeks, feel free to check in. If you'd like this to happen on a tighter timeframe, let me know as well. One thing I noticed about this library, (correct me if I'm wrong) you can only initialize one account with each type of supported platform. Is this correct? This surprised me a bit, as I would think some of these projects might be using multiple GA accounts. So instead of taking in one |
Sounds good.
Nope. You can load multiple GA instances https://getanalytics.io/plugins/google-analytics/#using-multiple-instances Not every provider plugin supports multiple instances but they could if the underlying analytics provider supports it. |
I see. Didn't know this doc existed before. Thanks for creating this neat and well-documented library. I'm pretty junior. So will need some hand-holding for this project. Hopefully it'll be a good learning experience for me and help mitigate some of the maintaining work of this lib on your side |
@BingWangEd how are you doing with this? Do shout back if you get stuck or need some help 👍 |
yes I'm working on it. will let folks know if I run into issues. Hopefully I'll get it done by 11/29 Sunday |
Just a headsup that I'm still working on this. Need some more time. But I'm on it~ |
Hi @DavidWells and folks, some update on this ticket. This is far from being done, but I left some comments/questions here. In particular, I need to think more about a good api to implement the I'm pretty junior. Any comments/suggestions regarding the code style, infrastructure, the way I set up babel, etc. are welcome. I'll continue to make changes. Thanks~ |
AFAIK the new API doesn't allow to disable protocol checks (they are hardcoded now) thus making it unusable in Electron, Cordova etc. serving pages from file:// That's a major drawback for some people. |
Hi, sorry how to connect analytics to the new google analytics 4 version? |
Sorry I took a break from this project because of another personal project. Basically the current library doesn't load Give me some time to finish this up. I'll send an official request for review by then |
Thanks! |
Why don't we update the library to always use
|
Agreed @mauriciabad — this should just go out as a major version bump in this plugin. |
Bumping the thread. Do we know how big a lift this will be? |
Just wanted to note that universal analytics is now scheduled for sunset on July 1 2023. I believe GA4 properties are completely separate from universal analytics properties and don't share data/history, so folks likely won't want to wait until the last minute to transition. |
I see that under the hood, @analytics/google-analytics loads
analytics.js
. With Google now making thegtag.js
its official JavaScript tagging framework, any plan to update it withgtag
?Happy to contribute.
The text was updated successfully, but these errors were encountered: