Facebook Pixel Implementation for Purchase Events with Custom Variable
-
Hi Thomas,
First and foremost, I want to express my gratitude for your fantastic plugin, which has allowed someone like me, with limited knowledge, to successfully track ecommerce events.
I’ve encountered an issue that has been quite perplexing. Despite spending hours searching for a solution, I haven’t been able to pinpoint what I’m missing. I’m almost certain that it’s something rather simple, but despite hours of searching and numerous attempts with different versions, I remain at a loss.
Here’s the crux of the issue: I managed to successfully implement the “add to cart” event to my Facebook pixel, complete with ID, value, and currency, thanks to code you shared on a different topic some time ago. However, my attempts at adapting it for the purchase event have, unfortunately, fallen flat. On the checkout page, Facebook only seems to register a simple pageview.
Here’s what I’ve used:
I have a tag with the following custom HTML
<script> if ( fbq ) { fbq( 'track', 'Purchase', { "content_ids": {{dlv – Ecommerce – Purchase product ID}}, "value": {{dlv – Ecommerce – Purchase product price}} * {{dlv – Ecommerce – Purchase product qty}}, "currency": {{dlv – Ecommerce – Currency Code}} }); } </script>
Triggered by the custom event:
gtm4wp.orderCompletedEEC
The variables used are as follows:
Name: dlv – Ecommerce – Purchase product ID
Data layer variable name: ecommerce.purchase.products.0.id
Name: dlv – Ecommerce – Purchase product price
Data layer variable name: ecommerce.purchase.actionField.revenue
Name: dlv – Ecommerce – Purchase product qty
Data layer variable name: ecommerce.purchase.products.0.quantity
Name: dlv – Ecommerce – Currency Code
Data layer variable name: ecommerce.currencyCode
Could you possibly pinpoint where I’ve gone wrong? Your insights would be immensely valuable. Thank you so much!
- The topic ‘Facebook Pixel Implementation for Purchase Events with Custom Variable’ is closed to new replies.