generated from vtex-apps/react-app-template
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Let a product's ID or name to be sent in the promo Analytics events (#76
) #### What problem is this solving? In the newest version of Google Analytics, GA4, the [`view_promotion`](https://developers.google.com/analytics/devguides/collection/ga4/reference/events?hl=en&client_type=gtag#view_promotion) event requires that either the product's ID or name is sent. In this PR, we allow this information to be provided via the props `productId` and `productName` that can be set via the Site Editor, just like other existing analytics props. Differently from current Universal Analytics [`promoView`](https://developers.google.com/analytics/devguides/collection/ua/gtm/enhanced-ecommerce?hl=en#promo-impressions) event, we didn't need to send any product information. #### How to test it? You can set these new fields via Site Editor by choosing any image that uses our `vtex.store-image` app, e.g.: 1. Visit https://filipelimaxga4viewpromo--storecomponents.myvtex.com/admin/cms/site-editor 2. Select the **Image List** section. 3. Select one of the images in the list. 4. Ensure the **Analytics event** radio is set to **Yes**. 5. Fill in the **Product ID** and **Product Name** text fields. ![Site Editor](https://user-images.githubusercontent.com/381395/221234860-4135d047-38b8-408b-aa6c-5f10b7bc65ac.png) 6. Click the in **Apply** button. 7. Click in the **Save** button. 8. Visit https://filipelimaxga4viewpromo--storecomponents.myvtex.com/ and open the web console. 9. Ensure the image with the promotion analytics data has been viewed. 10. Check the `dataLayer` window variable to ensure the `promoView` event contains the provided product data. ![dataLayer](https://user-images.githubusercontent.com/381395/221237733-5936731e-e39c-46ad-afad-7bb1cec5ae8f.png) #### Related to / Depends on - #29 was used to understand how the existing analytics props work. - vtex-apps/google-tag-manager#105 is where we're adding support to the GA4 `view_promotion` event. --------- Co-authored-by: Sheila Gomes <[email protected]>
- Loading branch information
1 parent
10c0697
commit b6d27a2
Showing
10 changed files
with
71 additions
and
15 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
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
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