Reputation: 340
I am trying to create a product catalog on Facebook using their pixel
The docs are here: https://www.facebook.com/business/help/887775018036966
Facebook detects the product information using the microdata (which is a json inside script tag) The problem is that Facebook pixel reads this data automatically and it doesn't happen on a single page application except for the first page.
Is there any way to make Facebook read the microdata manually?
Upvotes: 6
Views: 1160
Reputation: 19
I found a way to force it to re-read microdata by adding a listener on routeChange event in next/router and replacing the href property in window.location object
router.events.on("routeChangeStart", (url) => {
window.location.href = url;
})
Upvotes: 0
Reputation: 1
Create a new html file for your product page and then set URL redirects to go to that Html then every time someone views a product the FB pixels runs again and automatically detects the microdata
Upvotes: 0