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

591, 543: upgrade React, use Google Analytics module for OneTrust privacy banner #594

Conversation

jaydonkrooss
Copy link
Contributor

@jaydonkrooss jaydonkrooss commented Jan 10, 2025

The updated google analytics module uses react 18.3 so including the upgrade in this PR should help with testing.

Locally testing is possible with a VPN although the behavior of the privacy banner may differ from the actual test environment. To locally test using Umich credentials, use the following variables in .env:

GA_TRACKING_ID=G-YYZS5CR145
ONE_TRUST_SCRIPT_DOMAIN=03e0096b-3569-4b70-8a31-918e55aa20da

The test plan for the test environment will follow the same steps commented in the previous google analytics issue: #493 (comment)

@jaydonkrooss jaydonkrooss self-assigned this Jan 10, 2025
@jaydonkrooss jaydonkrooss linked an issue Jan 10, 2025 that may be closed by this pull request
@jonespm
Copy link
Member

jonespm commented Jan 10, 2025

Thanks for contributing this!

I was noticing that oneTrustScriptDomain is hardcoded and currently it is a fixed value for Ann Arbor. We should probably make this configurable like ga_tracking_id is. I'm fine if you want to just open that as a new issue rather than resolving it.

I was cleaning up the env in #554 so that may need to be committed first so it's documented there.

@jaydonkrooss
Copy link
Contributor Author

Thanks for contributing this!

I was noticing that oneTrustScriptDomain is hardcoded and currently it is a fixed value for Ann Arbor. We should probably make this configurable like ga_tracking_id is. I'm fine if you want to just open that as a new issue rather than resolving it.

I was cleaning up the env in #554 so that may need to be committed first so it's documented there.

Would adding it as a secret in the new .env require a kustomize process to be run? I remember discussing this with @lsloan a while back and he created issue #523 to address it.

If .env is a good workaround without too much trouble I'm fine with waiting for that PR to merge first before adding it

@jaydonkrooss jaydonkrooss changed the title 591: use Google Analytics module for OneTrust privacy banner 591, 543: upgrade React, use Google Analytics module for OneTrust privacy banner Jan 15, 2025
@jaydonkrooss jaydonkrooss linked an issue Jan 15, 2025 that may be closed by this pull request
useGoogleAnalytics(props.globals.ga_tracking_id, props.globals.debug);
useGoogleAnalytics({
googleAnalyticsId: props.globals.ga_tracking_id,
debug: props.globals.debug,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this package do when debug is turned on? I couldn't find that in the README for that project but might be useful to document there. Does it log anything to the console or do anything?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I've seen, the debug prop was inherited from the first implementation of google analytics, apparently it just enables testMode for the googleAnalytics instance, which is useful only for testing event calls. I think this prop should be renamed to testMode and we utilize debug for logging, like you said.

I created an issue to address this in the project tl-its-umich-edu/react-ga-onetrust-consent#7

@jonespm jonespm self-requested a review January 16, 2025 07:13
@jonespm
Copy link
Member

jonespm commented Jan 16, 2025

Getting this error trying it out, were you seeing this one? I'm not sure what it means yet as is in a component.

router.js:241 Uncaught Error: useLocation() may be used only in the context of a <Router> component.
    at App (app.tsx:22:23)

@jonespm
Copy link
Member

jonespm commented Jan 16, 2025

So it seems like this might be an issue more with the upgrade of react and 2 different versions of react-router-dom being loaded? It looks like both 6.25.1 and 6.28.1 are added?

I added this to package.json and that seems to get it loaded. Do you know if this is the best way? It looks like onetrust might be the only one that has an old version to updating that might also fix this, but possible save to have this in here?

  "overrides": {
    "react-router-dom": "^6.28.1"
  },

@jaydonkrooss
Copy link
Contributor Author

So it seems like this might be an issue more with the upgrade of react and 2 different versions of react-router-dom being loaded? It looks like both 6.25.1 and 6.28.1 are added?

I added this to package.json and that seems to get it loaded. Do you know if this is the best way? It looks like onetrust might be the only one that has an old version to updating that might also fix this, but possible save to have this in here?

  "overrides": {
    "react-router-dom": "^6.28.1"
  },

I think updating it in the module may make the most sense in this case, no need to put in an override as it might lead to dependency issues in the future. Open to other suggestions but I'll just go ahead with that patch as version 1.1.2 on react-ga-onetrust-consent

Copy link
Member

@zqian zqian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully tested with the test plan and TunnelBear VPN settings.

@jaydonkrooss jaydonkrooss merged commit 980316e into tl-its-umich-edu:master Jan 20, 2025
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

Successfully merging this pull request may close these issues.

Update the react-ga-onetrust-consent module for privacy banner Upgrade to React 18.3
3 participants