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

vIceBerg
  • 4,197
  • 5
  • 40
  • 53

2 Answers2

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

Eflyax
  • 5,307
  • 2
  • 19
  • 29
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

Marnix.hoh
  • 1,556
  • 1
  • 15
  • 26