Facebook pixel microdata on a single page application
Asked Answered
C

2

6

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?

Chao answered 17/3, 2019 at 12:34 Comment(4)
I am trying to solve the same issue. We can actually do fbq("track", "Microdata") but this sends the microdata from the first page loaded again - there seems to be a cache somewhere but to my great dismay I cannot find it.Tetracycline
@Chao did you find anything?Grantor
No. We decided to let go of FB because we didn't find any solution for thisChao
i've tried fbq('track',Microdata) without success. It fires the event but the products are never added to the catalogBuffington
F
0

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

Furious answered 7/1, 2021 at 14:43 Comment(1)
Thanks for the answer, but doesn't this means I'm leaving the single page?Chao
P
0

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;
})
Pappus answered 20/12, 2022 at 14:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.