Integrate with facebook pixel
-
Dear gtm4wp
Can I use gtm4wp and tag manager to fire event to facebook pixel and also get value of order
-
Hi,
Yes, you can if you are using WooCommerce.
GTM4WP has direct integration with WooCommerce giving you the for example the order value on the “order received” page. If you are using any other ecommerce plugins, you might need additional coding.Hi Thomas,
I am at the exact same step.
How do I set up the FB pixel events in GTM4WP? Do you know a good step-by-step guide similar to your “setup enhanced e-commerce” guide.
Regards,
EdwardSame here? Any GTM recipes out there for integrating the facebook pixel with gtm4wp?
Well, the ecommerce data layer codes are there and GTM events are there as well but let me give you an example, perhaps you can iterate this to all FB events:
AddToCart
=========Create a new variable with the type Data Layer Variable and enter this variable name: ecommerce.add.products.0.id
Let’s name this “dlv – Ecommerce – Add to cart product ID”Create another data layer variable with the variable name ecommerce.add.products.0.price
Let’s name this “dlv – Ecommerce – Add to cart product price”Create another data layer variable with the variable name ecommerce.add.products.0.quantity
Let’s name this “dlv – Ecommerce – Add to cart product qty”Create another data layer variable with the variable name ecommerce.currentyCode
Let’s name this “dlv – Ecommerce – Currency Code”Create a new trigger using the Custom Event type and enter this event name: gtm4wp.addProductToCartEEC
Create a new Custom HTML tag and add this trigger to it.
Enter this HTML:<script> if ( fbq ) { fbq( 'track', 'AddToCart', { "content_ids": {{dlv - Ecommerce - Add to cart product ID}}, "value": {{dlv - Ecommerce - Add to cart product price}} * {{dlv - Ecommerce - Add to cart product qty}}, "currency": {{dlv - Ecommerce - Currency Code}} }); } </script>
This will transmit the product ID and value added to the cart.
You can setup something similar for other Facebook ecommerce events.
This is wonderful for orders!
But how would be transmit info for retargeting people who viewed a specific product on woocommerce and did not buy? And then retarget them in FB?
Do we need utm?
My head hurts lol.
Hi,
No, you do not need utms for that.
If you have setup your Facebook event tags in your GTM container, you can use a Facebook Catalog campaign which will give you proper options to target cart abandons in your retargeting efforts.Hi Thomas,
I can see in your example above the trigger for add to cart (gtm4wp.addProductToCartEEC).
I want to add a purchase trigger to configure the FB Pixel Purchase event but can’t see from the values set in GTM which that would actually be (gtm4wp.productClickEEC|gtm4wp.addProductToCartEEC|gtm4wp.removeFromCartEEC|gtm4wp.checkoutOptionEEC|gtm4wp.checkoutStepEEC|gtm4wp.changeDetailViewEEC). Which is actually the indicator of a transaction being completed that can be used for this?
I’m using a single checkout paid if that makes any difference?
Loving the plugin ??
Thanks,
NickHi Nick,
On the order received page there is a gtm4wp.orderCompletedEEC event but it is actually not needed. You need to fire your FB purchase tag using a “Page View” trigger where you restrict the trigger to fire only on the order received page (using Page URL filtering)
Hello,
thank you for the work you doing on GTM4WP. It’s amazing.
I’m doing similar integration – need to track the Add To Cart buttons via FB pixel. It’s not a problem to set up script in GTM but the main issue that I’m missing any kind of information after button Add To Cart is hitten in data layer. I have all information about the content of cart, but no about the event add to cart (like ecommerce.add.products.0.price etc…). See https://prntscr.com/u8i2z3
The purchasing buttons are listed here – https://www.tvurcivpraxi.cz/online-kurzy/jak-se-dela-znacka/ see – https://prntscr.com/u8i4gk
Here is my plugin settings – https://prntscr.com/u8ibr9 + https://prntscr.com/u8ic2f
Thank you very much for you advice how to get add to cart part of datalayer.
Best regards, David
- This reply was modified 4 years, 2 months ago by david.nemec.
- This reply was modified 4 years, 2 months ago by david.nemec.
FTR the post of @kosak is answered in its own thread:
https://www.ads-software.com/support/topic/add-to-cart-data-layer-is-missing/Hi Thomas,
Excellent work with the plugin.
I would like to use the parent product id (not the variation id) of the order items at the FB Pixel Purchase event.I can see the gtm4wp.orderCompletedEEC event at the order received page which provides the variation id.
How can I push to the datalayer the parent product id as well on the order received?
Thanks,
TheoharisHi @theoharis ,
Please open a new thread next time for your questions. It keeps the forum clear and easy to find information.
You need to create your own PHP code for example inside your (child) theme.
There you can use this WordPress filter name to catch product data before it gets dumped into the data payer:gtm4wp_eec_product_array
Here you will get two parameters:
* the first will be an associative array with EEC product data (including variation ID)
* the second will be the purpose where this data will be used. On the order received page this will be “purchase”You need to return a new associative array with updated product data.
- The topic ‘Integrate with facebook pixel’ is closed to new replies.