How to prevent Facebook Pixel to track the same transaction twice?
Asked Answered
D

2

6

In my Purchase confirmation page, I send the purchase info to Facebook. But if my user hits Refresh, the data is sent again and Facebook compile the purchase values twice.

With Google Analytics, we can send a Transaction ID and even if the user refresh the page, the data is compiled only once.

Is there a way to achieve the same thing with Facebook? I would prefer to let Facebook do the job instead of having a flag on my side to send the Pixel only once.

Thanks

Dessau answered 30/5, 2017 at 15:5 Comment(0)
B
1

I solved this problem using sessions. Before you render purchase page you can set some session flag which trigger rendering FB pixel code (or whatever) => after rendering this code you can remove this session. When your customer refresh page session is not set so your FB pixel code not rendered twice.

I used this idea in my extension for Nette Framework: Eflyax/facebook-pixel

Bentley answered 7/11, 2018 at 15:52 Comment(0)
K
0

I also was looking for a similar feature to Google Analytics's Transaction ID to deduplicate events.

So it turns out that Facebook does have such a parameter. Facebook calls it the eventID and it's used like this:

fbq('track', 'Purchase', {value: 12, currency: 'USD'}, {eventID: 'EVENT_ID'});

You can find the documentation of this parameter here: Facebook docs

Koren answered 20/5, 2022 at 14:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.