-
Notifications
You must be signed in to change notification settings - Fork 41
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
Adjust some price fields #114
base: master
Are you sure you want to change the base?
Conversation
#### What problem is this solving? It sends the [GA4 `select_promotion`](https://developers.google.com/analytics/devguides/collection/ga4/reference/events?hl=en&client_type=gtag#select_promotion) event when `vtex:promotionClick` is received. https://developers.google.com/analytics/devguides/collection/ga4/reference/events?hl=en&client_type=gtag#select_promotion| -| ![CleanShot 2023-01-30 at 09 34 15](https://user-images.githubusercontent.com/381395/215479682-9e9a319f-79f0-43e0-a2c3-2e0a97872242.png)| #### How should this be manually tested? A new test has been added and can be run with `yarn test`. #### Types of changes * [ ] Bug fix (a non-breaking change which fixes an issue) * [x] New feature (a non-breaking change which adds functionality) * [ ] Breaking change (fix or feature that would cause existing functionality to change) * [ ] Requires change to documentation, which has been updated accordingly.
#### What is the purpose of this pull request? Implements the update function working as described on [docs](https://developers.google.com/tag-manager/ecommerce-ga4?hl=pt-br#measure_promotion_clicks) and following the line implemented in [faststore](https://github.com/vtex-sites/nextjs.store/blob/chore/add-sentry/src/sdk/analytics/index.tsx#L18:L18), isolating the event data and update the event with the correct body #### What problem is this solving? Send the events to `window.dataLayer` in the correct format #### How should this be manually tested? check if the events in dataLayer are in the correct format `{event: ..., ecommerce: { ... } }` #### Screenshots or example usage #### Types of changes * [ ] Bug fix (a non-breaking change which fixes an issue) * [X] New feature (a non-breaking change which adds functionality) * [ ] Breaking change (fix or feature that would cause existing functionality to change) * [ ] Requires change to documentation, which has been updated accordingly.
#### What is the purpose of this pull request? This PR intends to add the `add_to_cart` GA4 event to be sent when `vtex:addToCart` is received. [`add_to_cart` event](https://developers.google.com/analytics/devguides/collection/ga4/reference/events?hl=en&client_type=gtag#add_to_cart)| -| ![Screen Shot 2023-02-08 at 16 09 23](https://user-images.githubusercontent.com/15722605/217628290-5a2275a3-eb0f-4e8b-9982-2475f916d1b1.png)| #### How should this be manually tested? - In your local environment, inside the `google-tag-manager` app repository, go to the branch `feat/ga4-add-to-cart-event`; - Login in your preferred account and workspace; - Link the app; - Go to the Admin and access the App Store. Look for the Google Tag Manager app and access the `Settings`; - Check the `Merge Universal Analytics and Google Analytics 4 Events` option; - Access the store and perform add an item to the cart; - Check the `dataLayer` object (just type `dataLayer` in the console and press enter). The event data should be in the list. ![Screen Shot 2023-02-08 at 17 48 57](https://user-images.githubusercontent.com/15722605/217649666-f0198fe8-7d97-463c-af8b-510d8f7249a7.png) #### Types of changes * [ ] Bug fix (a non-breaking change which fixes an issue) * [x] New feature (a non-breaking change which adds functionality) * [ ] Breaking change (fix or feature that would cause existing functionality to change) * [ ] Requires change to documentation, which has been updated accordingly.
#### What is the purpose of this pull request? This PR intends to add the `remove_from_cart` GA4 event to be sent when `vtex:removeFromCart` is received. [`remove_from_cart` event](https://developers.google.com/analytics/devguides/collection/ga4/reference/events?hl=en&client_type=gtag#remove_from_cart)| -| ![Screen Shot 2023-02-10 at 16 58 20](https://user-images.githubusercontent.com/15722605/218186124-d9e080c6-6595-4ea7-b0c0-44661090f44a.png)| #### How should this be manually tested? - In your local environment, inside the `google-tag-manager` app repository, go to the branch `feat/ga4-remove-from-cart-event`; - Login in your preferred account and workspace; - Link the app; - Go to the Admin and access the App Store. Look for the Google Tag Manager app and access the `Settings`; - Check the `Merge Universal Analytics and Google Analytics 4 Events` option; - Access the store and perform add an item to the cart; - Check the `dataLayer` object (just type `dataLayer` in the console and press enter). The event data should be in the list. #### Types of changes * [ ] Bug fix (a non-breaking change which fixes an issue) * [x] New feature (a non-breaking change which adds functionality) * [ ] Breaking change (fix or feature that would cause existing functionality to change) * [ ] Requires change to documentation, which has been updated accordingly.
#### What is the purpose of this pull request? This PR intends to add the `purchase` GA4 event to be sent when `vtex:orderPlaced` is received. [`purchase` event](https://developers.google.com/analytics/devguides/collection/ga4/reference/events?hl=pt-br&client_type=gtag#purchase)| -| ![Captura de Tela 2023-02-14 às 12 31 46](https://user-images.githubusercontent.com/36740164/218783507-d6c8bc46-6afa-4487-9132-bcf519a61eec.png) #### How should this be manually tested? - In your local environment, inside the `google-tag-manager` app repository, go to the branch `feat/ga4-remove-from-cart-event`; - Login in your preferred account and workspace; - Link the app; - Go to the Admin and access the App Store. Look for the Google Tag Manager app and access the `Settings`; - Check the `Merge Universal Analytics and Google Analytics 4 Events` option; - Access the store and perform add an item to the cart and complete a checkout; - Check the `dataLayer` object (just type `dataLayer` in the console and press enter). The event data should be in the list. #### Types of changes * [ ] Bug fix (a non-breaking change which fixes an issue) * [x] New feature (a non-breaking change which adds functionality) * [ ] Breaking change (fix or feature that would cause existing functionality to change) * [ ] Requires change to documentation, which has been updated accordingly.
#### What problem is this solving? Push the GA4's [`view_promotion`](https://developers.google.com/analytics/devguides/collection/ga4/reference/events?hl=en&client_type=gtag#view_promotion) event when `vtex:promoView` is triggered. #### How to test? 1. Visit https://filipelimaxga4viewpromo--storecomponents.myvtex.com/. 2. Click the right arrow button to see the next gallery image. 3. Check the `dataLayer` variable in the web console to ensure the `view_promotion` was fired. ![CleanShot 2023-02-27 at 10 53 44](https://user-images.githubusercontent.com/381395/221582147-f06fd60f-de92-45c7-b97f-8a045bb61a34.png)
We initially thought we needed to merge both events, but in the end we decided to push them separately so this new wording reflects better what's happening.
Hi! I'm VTEX IO CI/CD Bot and I'll be helping you to publish your app! 🤖 Please select which version do you want to release:
And then you just need to merge your PR when you are ready! There is no need to create a release commit/tag.
|
Beep boop 🤖 I noticed you didn't make any changes at the
In order to keep track, I'll create an issue if you decide now is not a good time
|
#### What problem is this solving? - Add tests to GA4 `select_item`, `view_item`, and `view_item_list` events. - Remove unused types `CategoryTreeItem` and `CategoryTree`. - Stop exporting the util function `removeStartAndEndSlash` because it's only used internally. - Type event payloads for better safety. #### How should this be manually tested? Run new and existing tests with `yarn test`.
We had added `PriceWithoutDiscount`, but after double checking real data, we found not all events send in this field, so we cannot reliably use that. `ListPrice` has the original price, and `Price` has the price with discount, so we can simply subtract them.
`CommertialOffer`'s `Price` returns the price **with** discount.
What problem is this solving?
Review all events and make sure we're using correct values for
value
, and items'price
anddiscount
fields.