Skip to content

Commit

Permalink
actually call gcm api and always set defaults first
Browse files Browse the repository at this point in the history
build
  • Loading branch information
yoshson committed Jun 4, 2024
1 parent 089b75b commit c77574b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion feincms3_cookiecontrol/static/f3cc/gcm.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 13 additions & 11 deletions src/gcm.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
window.addEventListener("f3cc_consent_granted", () => {
updateGAConsentData("granted")
})
window.addEventListener("f3cc_consent_denied", () => {
updateGAConsentData("denied")
})
const updateGAConsentData = (status) => {
const dataLayer = (window.dataLayer = window.dataLayer || [])
dataLayer.push([
window.dataLayer = window.dataLayer || []
function gtag(){dataLayer.push(arguments)}
function setGAConsentData(action, status) {
gtag(
"consent",
"update",
action,
{
ad_user_data: status,
ad_personalization: status,
ad_storage: status,
analytics_storage: status,
},
])
)
}
setGAConsentData("default", "denied")
window.addEventListener("f3cc_consent_granted", () => {
setGAConsentData("update", "granted")
})
window.addEventListener("f3cc_consent_denied", () => {
setGAConsentData("update", "denied")
})

0 comments on commit c77574b

Please sign in to comment.