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
Analytics feedbacks #2025
Analytics feedbacks #2025
Conversation
Oxygen deployed a preview of your
Learn more about Hydrogen's GitHub integration. |
Fixes #0000 👯 |
This comment has been minimized.
This comment has been minimized.
return window.Shopify.customerPrivacy.analyticsProcessingAllowed(); | ||
} | ||
return false; | ||
} catch (error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit picky, but worth printing the error? Or maybe just killing the param altogether?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ts doesn't like catch() {}
. End with catch(e) {}
typeof window?.Shopify?.customerPrivacy?.analyticsProcessingAllowed === | ||
'function' | ||
) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit picky, but could this whole if statement just be typeof window?.Shopify?.customerPrivacy?.analyticsProcessingAllowed === 'function'
? If any property along the way is undefined, typeof undefined
will not be function
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good call .. in fact, since the whole thing is in a try-catch, the if
statement is not needed
The try catch is needed because this function may be run at server side
WHY are these changes introduced?
<Analytics.Provider>
will not send any events.consent.checkoutDomain
andconsent.storefrontAccessToken
is requiredIntroduce
onReady
callback foruseCustomerPrivacy
hook.WHAT is this pull request doing?
HOW to test your changes?
Use
analytics
example:consent.checkoutDomain
from root loader --> site should generate error about missing propsconsent.storefrontAccessToken
from root loader --> site should generate error about missing propsconsent.withPrivacybanner: false
in the root loader --> You should seeCustomAnalytics
logging page views in the console logPost-merge steps
Checklist