-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: import
sendAnalyticsEvent
on demand (#2472)
## What's the purpose of this pull request? This PR is part of the Performance epic and aims to import the `sendAnalyticsEvent` method from `faststore/sdk` dynamically instead of static so that it will not be part of the initial bundle. ## How to test it? 1. run `yarn dev`. 2. Following the https://developers.vtex.com/docs/guides/faststore/troubleshooting-analytics-and-partytown#see-events-pushed-to-datalayer We need to put it in the console when we use the `partytown` to see the events in the dataLayer: ```js window.dataLayerHistory = [] const originalPush = dataLayer.push dataLayer.push = (data) => { console.log(data) dataLayerHistory.push(data) originalPush(data) } ``` 3. Then navigate to the pages and double-check that the tags are being triggered as before. Check the image below. <img width="1906" alt="Screenshot 2024-09-20 at 18 46 46" src="https://github.com/user-attachments/assets/89cc7f21-0663-441e-a24b-5f53b43984c5"> ### Starter PR - vtex-sites/starter.store#550 PSI Snapshot <img width="897" alt="Screenshot 2024-09-25 at 18 11 24" src="https://github.com/user-attachments/assets/87ca71e2-c184-4d08-a6d3-e219f95d1df6">
- Loading branch information
1 parent
52d1483
commit 8838ee8
Showing
11 changed files
with
239 additions
and
225 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 11 additions & 10 deletions
21
packages/core/src/sdk/analytics/hooks/usePageViewEvent.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.