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

feat(gtm): add optionnal consent mode #72

Merged
merged 8 commits into from
Sep 23, 2024

Conversation

huang-julien
Copy link
Contributor

linked to nuxt/scripts#243
same as #71 but for GTM

Seems like this require to push arguments into the datalayer array. 🤷‍♂️

Result with the GTM debugger:

image

@huang-julien huang-julien changed the title Fix/gtm consent fix(gtm): set default consent of gtm to denied Sep 4, 2024
@huang-julien huang-julien marked this pull request as draft September 4, 2024 19:20
@huang-julien huang-julien marked this pull request as ready for review September 4, 2024 19:35
Copy link
Collaborator

@housseindjirdeh housseindjirdeh left a comment

Choose a reason for hiding this comment

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

LGTM. Will defer to @flashdesignory for a sanity check before we merge

Copy link
Collaborator

@flashdesignory flashdesignory left a comment

Choose a reason for hiding this comment

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

🚀

@huang-julien huang-julien marked this pull request as draft September 11, 2024 19:38
@huang-julien
Copy link
Contributor Author

Setting this to draft mode until #73 lands on main branch

@felixarntz
Copy link
Collaborator

@huang-julien Just merged #73, so you should now be able to use the {{#consentValues}}...{{/consentValues}} syntax from there.

@huang-julien
Copy link
Contributor Author

Woohoo 🎉🎉 thank you ! I'll update the PR tomorrow !

@huang-julien huang-julien marked this pull request as ready for review September 12, 2024 09:31
Copy link
Collaborator

@flashdesignory flashdesignory left a comment

Choose a reason for hiding this comment

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

LGTM - let's wait for @felixarntz as well before merging!

Copy link
Collaborator

@felixarntz felixarntz left a comment

Choose a reason for hiding this comment

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

@huang-julien Looks good except two things, I think specifically the inclusion of consentValues in the schema optionalParams is important.

Once this is merged, the PHPUnit tests will probably fail, I can follow up with that. I just realized the reason that this isn't flagged here is because we have an allowlist of file types in there, and the data/*.json files aren't among them - so we should fix so that in the future we'll find out "automatically" prior to merging.

"optionalParams": {
"l": "dataLayer"
"l": "dataLayer",
"consentType": "default"
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think consentValues needs to be present here, like with Analytics? https://github.com/GoogleChromeLabs/third-party-capital/blob/main/data/google-analytics.json#L23

Suggested change
"consentType": "default"
"consentType": "default",
"consentValues": null

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh, consentValues can be undefined. null and undefined both count as falsy boolean expression. We can also remove it from analytics so the JSON can be slightly lighter.

Copy link
Collaborator

Choose a reason for hiding this comment

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

oh, consentValues can be undefined. null and undefined both count as falsy boolean expression. We can also remove it from analytics so the JSON can be slightly lighter.

Generally makes sense, however wouldn't it be more intuitive to still have those be explicitly listed in optionalParams? I think it helps DX to be able to quickly scan the params and optionalParams and know what's available. Otherwise you'll have to look at the less obvious and harder to parse "code" value.

I don't think it technically makes a difference whether they're explicitly defined or not, but personally I think there's a benefit of keeping them in there.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I get it now, llet's keep it 👍

src/types/type-declarations.ts Outdated Show resolved Hide resolved
@huang-julien huang-julien changed the title fix(gtm): set default consent of gtm to denied feat(gtm): add optionnal consent mode Sep 14, 2024
@flashdesignory flashdesignory merged commit 2657bb4 into GoogleChromeLabs:main Sep 23, 2024
3 checks passed
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.

4 participants