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

[addon:google-analytics]: Add support for Google Analytics 4 #3

Open
bufordeeds opened this issue May 5, 2022 · 7 comments
Open

[addon:google-analytics]: Add support for Google Analytics 4 #3

bufordeeds opened this issue May 5, 2022 · 7 comments

Comments

@bufordeeds
Copy link

Please add support for the new tracking IDs for Google Analytics 4. Google is moving from Universal Analytics (UA) to Google Analytics 4 (GA4) and it seems like the current addon doesn't support GA4 IDs.

@Grienauer
Copy link

please be aware, that due to gdpr, you have to ask your users if they wan't to accept/load google analytics or not. in Austria and France it is illegal to use it at all (current court cases).

@bufordeeds
Copy link
Author

Oh for sure. This is for internal tracking purposes.

@shilman shilman transferred this issue from storybookjs/storybook Jun 2, 2022
@chrisgriffin
Copy link

Is there a workaround until this addon gets updated?

@michaelsawyers
Copy link

And updates/ workarounds for this?

@M1rotvorez
Copy link

I had to use an alternative library to use GA4 tracking.
Since the code of this addon was a simple configuration of the component react-ga I decided to switch from it to the initialization of a similar library, but for GA4 - react-ga4.
Configured in the file manage.js as described in the documentation of the library.

Maybe this solution will help someone.

@steveoh-rose
Copy link

I had to use an alternative library to use GA4 tracking. Since the code of this addon was a simple configuration of the component react-ga I decided to switch from it to the initialization of a similar library, but for GA4 - react-ga4. Configured in the file manage.js as described in the documentation of the library.

Maybe this solution will help someone.

Currently in the process of this, do you mind showing a code snippet of how you did this in the manage.js file?

@M1rotvorez
Copy link

M1rotvorez commented Jun 15, 2023

@steveoh-rose I decided not to implement the GA4 configuration in manage.js. I put it in preview.js (I needed to track events within components). Configuration looks like:

import ReactGA from "react-ga4";

ReactGA.initialize(GA_ID, {
  gtagOptions: { 
    debug_mode: true,
    content_group: 'storybook'
  }
});

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

6 participants