-
Notifications
You must be signed in to change notification settings - Fork 47
feat: wrap the store around AdsProvider #605
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
Conversation
|
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
|
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||||
cd4a795 to
efba2b8
Compare
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.
Pull Request Overview
This PR integrates VTEX Ads functionality across the store by wrapping components with an AdsProvider. The main purpose is to enable ad serving capabilities throughout the store interface.
- Adds
AdsProviderSFcomponent that wraps store content and search functionality - Refactors user session data utilities into reusable hooks for ads and pixel components
- Replaces sponsored products configuration with publisherId setting for ads integration
Reviewed Changes
Copilot reviewed 9 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| manifest.json | Updates version and replaces fetchSponsoredProductsOnSearch with publisherId setting |
| store/contentSchemas.json | Adds publisherId configuration field for VTEX Ads |
| react/package.json | Adds @vtex/ads-react dependency |
| react/hooks/getUserData.tsx | Creates reusable utilities for extracting user session data |
| react/components/UserDataPixel.tsx | Refactors to use extracted getUserData utilities |
| react/components/AdsProviderSF.tsx | Creates new ads provider component with product matching logic |
| react/StoreWrapper.js | Wraps store content with AdsProviderSF component |
| react/SearchWrapper.tsx | Adds debug text to SearchWrapper |
| react/SearchContext.jsx | Wraps SearchQuery with AdsProviderSF component |
vmourac-vtex
left a comment
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.
- Adicionar
CHANGELOG.md - Adicionar uma descrição no PR de acordo com o template do repositório
- Precisamos de workspaces para validar os comportamentos antes e depois das mudanças
react/hooks/getUserData.tsx
Outdated
| account?: { | ||
| accountName?: { | ||
| value: string | ||
| } | ||
| id?: { | ||
| value: string | ||
| } | ||
| } |
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.
@rodorgas qual a necessidade de adicionar novos atributos no SessionResponse. Adicionando esses novos atributos o setSessionId vai atualizar a session com esses novos atributos, sendo enviados nos próximos requests. Isso pode impactar o cache hit rate da plataforma, dado que a session é um dos itens da chave de cache.
Qual a necessidade de alterar a session? Tem alguma outra forma disso ser feito?
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.
@vmourac-vtex Bom ponto, os atributos novos não têm a necessidade de serem adicionados, acabei de removê-los.
EDIT: Precisei re-adicionar o campo "id" pois precisamos para obter o session_id.
|
Oi @MatheusLealv. Tem alguma forma de testar essa feature? Vi que há outros PRs associados, pode ser um workspace com tudo linkado. Aí pode adicionar na descrição do PR as instruções de como testar. |
|
Oi @vsseixaso Instalei/Linkei todos os apps necessários no account Você pode conferir aqui: https://leal--biggy.myvtex.com/ e pesquisar pelo termo "camisa" |
|
@MatheusLealv, não deveria estar aparecendo a tag "Patrocinado"?
|
#### What problem is this solving? <!--- What is the motivation and context for this change? --> We're changing the encoded event parameters from `adId` to `eventParameters`, since it's not the ad ID. The data attribute is still using the data-van-aid since that's what the Activity Flow use to track events (to be changed in future). This is backwards compatible as it keeps using the `adId` as fallback to the `eventParameters` parameter. It also removes many data properties that are not being used anymore, since the `data-van-aid` is the only one considered by Activity Flow currentyl #### How to test it? <!--- Don't forget to add a link to a Workspace where this branch is linked --> In this workspace, https://leal--biggy.myvtex.com/ search for the term "camisa". #### Screenshots or example usage: <img width="1624" height="1060" alt="image" src="https://github.com/user-attachments/assets/3593a558-1ac6-4cb8-859c-93fb6fea0277" /> <!--- Add some images or gifs to showcase changes in behaviour or layout. Example: before and after images --> #### Related to / Depends on vtex-apps/store#605 vtex-apps/search-result#711 --------- Co-authored-by: Matheus Leal <[email protected]> Co-authored-by: Vinícius Seixas <[email protected]>
Co-authored-by: Copilot <[email protected]>
cfb694d to
f41268b
Compare
|
Rodei um rebase com a master para resolver os conflitos 🙂 |
|
@copilot can you review latest changes since last approval? |
|
@vmourac-vtex I've opened a new pull request, #630, to work on those changes. Once the pull request is ready, I'll request review from you. |
|
Your PR has been merged! App is being published. 🚀 After the publishing process has been completed (check #vtex-io-releases) and doing A/B tests with the new version, you can deploy your release by running:
After that your app will be updated on all accounts. For more information on the deployment process check the docs. 📖 |

User description
What problem is this solving?
This PR is part of the Ads Frictionless Integration on the Store Framework (RFC).
In order to allow components such as shelves, search result and autocomplete to make ad requests, we must wrap the store around the
AdsProvidercomponent. Then, the store will use thepublisherIdsetting that is initialized earlier on the process, when the admin user join VTEX Ads (via vtex/ads-onboarding)The requests uses the Ads SDK, that implements the client to request ads and merge product data with SKUs from ads.
An important change this feature will enable in comparison to the current solution is hydrating the ads on the client-side. By doing on the client-side, we're able to hit the CDN cache for product data, as opposed to returning ads with full product data that cannot be cached (since ads are picked by a real-time auction).
How to test it?
In this workspace, https://leal--biggy.myvtex.com/ search for the term "camisa".
Screenshots or example usage:
Sponsored products being displayed as usual when searching for product keywords of an active campaign:
Related to / Depends on
vtex-apps/product-summary#411
vtex-apps/search-result#711
PR Type
Enhancement
Description
Integrate VTEX Ads provider across store components
Add publisher ID configuration for ads functionality
Extract user session data utilities for reuse
Update manifest schema for ads configuration
Diagram Walkthrough
File Walkthrough
7 files
Wrap store content with AdsProviderSF componentAdd type declaration for product search queryAdd publisherId to StoreSettings interfaceWrap SearchQuery with AdsProviderSF componentCreate new ads provider component with product matchingExtract user data utilities to separate hookCreate reusable user session data utilities2 files
Replace sponsored products setting with publisherIdReplace sponsored products with publisherId setting1 files
Add debug text to SearchWrapper component1 files
Add VTEX ads React dependency