Skip to content

feat: ✨ add spaPageview support #4

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

Open
wants to merge 1 commit into
base: development
Choose a base branch
from

Conversation

HofmannZ
Copy link
Member

This PR adds support for the new spaPageview method. It can be used to manually trigger a pageview without having to access Zaraz internals like zarazData.l, zarazData.t, or zaraz.__zarazMCListeners.

spaPageview is not yet officially documented by Cloudflare.

@HofmannZ HofmannZ requested a review from a team February 20, 2024 09:09
@HofmannZ HofmannZ self-assigned this Feb 20, 2024
Copy link

codecov bot commented Feb 20, 2024

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (5c2ea5a) 87.09% compared to head (6a95ff2) 83.33%.

Files Patch % Lines
src/helpers/get-zaraz.ts 0.00% 2 Missing ⚠️
Additional details and impacted files
@@               Coverage Diff               @@
##           development       #4      +/-   ##
===============================================
- Coverage        87.09%   83.33%   -3.77%     
===============================================
  Files                4        5       +1     
  Lines               31       36       +5     
  Branches             3        3              
===============================================
+ Hits                27       30       +3     
- Misses               4        6       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@HofmannZ HofmannZ force-pushed the @HofmannZ/feature/spa-pageview branch from 48735de to 6a95ff2 Compare February 20, 2024 09:10
@@ -29,6 +29,9 @@ export function getZaraz() {
ecommerce: (...args: unknown[]) => {
queue.push({ method: 'ecommerce', arguments: args });
},
spaPageview: (...args: unknown[]) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

not related with this PR but should we also add consent here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Would be really tricky to queue that. The consent API also has some getters instead of only setters.

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.

2 participants