Support

Home Forums Event Espresso Premium Add Facebook pixel code to cart and/or Thank You page

Add Facebook pixel code to cart and/or Thank You page

Posted: April 3, 2019 at 4:11 am

Viewing 6 reply threads


WEMconference

April 3, 2019 at 4:11 am

Hi

I am using the latest versions of the core and all plugins.

I have searched the forum and cannot find how to add my facebook pixel tracking to the correct templates in EE4, I am using Multiple Event Registration plugin and ideally would like to track individual tickets and prices of tickets sold.

Initially I would like to be able to inject the facbook pixel and event tracking code to the correct page/s.

In this post…

https://eventespresso.com/topic/include-google-analytics-ecommerce-tracking/

You mention the php templates….

thank-you-page-registration-details.template.php
thank-you-page-transaction-details.template.php

1. Can i just add something like below to the checkout page?
2. What method would you recommend i use to add the code to the specific page/s or Templates?

Can you please point me in the right direction as to what is the best solution.

<!-- Facebook Pixel Code -->
<script>
!function(f,b,e,v,n,t,s)
{if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};
if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];
s.parentNode.insertBefore(t,s)}(window, document,'script',
'https://connect.facebook.net/en_US/fbevents.js');
fbq('init', 'xxxxxxxxxxxxxxx');
fbq('track', 'PageView');
</script>
<noscript><img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id=347772375846239&ev=PageView&noscript=1"
/></noscript>
<script>
fbq('track', 'Purchase', {
value: 140.00,
currency: 'GBP',
content_ids: '240',
content_type: 'Ticket',
});
</script>
<script>
fbq('track', 'Purchase', {
value: 140.00,
currency: 'GBP',
content_ids: '280',
content_type: 'Ticket',
});
</script>
<script>
fbq('track', 'Purchase', {
value: 594.00,
currency: 'GBP',
});
</script>
<!-- End Facebook Pixel Code -->

If necessary i can open a premium support request to get further details?

Thanks!


Josh

  • Support Staff

April 3, 2019 at 8:27 am

Hi Ben,

I can advise getting in touch with a developer to add the needed code. One reason is because the code you posted here has hardcoded values, but your implementation is likely going to need to have dynamic values. So you can’t just add the tracking code to a page. There will need to be some custom development to extract those dynamic values, and that development is beyond what we can provide as part of a priority support token.

I can point you in the direction of codeable.io as they have expertise in PHP & WordPress development and somethere there can give you a quote for the work this would require.


WEMconference

April 3, 2019 at 9:24 am

This reply has been marked as private.


Josh

  • Support Staff

April 3, 2019 at 9:34 am

The code you posted above does not include code to output a facebook tracking pixel, so yes, it does look like you’re going in the wrong direction.

In addition, the if ( is_page( 'order-successful' ) ) { check will ensure the code only runs if the page slug is order-successful. So you’ll likely need to change that part too.


WEMconference

April 3, 2019 at 9:59 am

This reply has been marked as private.


Josh

  • Support Staff

April 3, 2019 at 10:04 am

Hi,

I can advise teaming up with a developer for this project because code reviews are outside the scope of support.


WEMconference

April 3, 2019 at 10:06 am

Ok thanks for your help, i appriecite it.

Viewing 6 reply threads

The support post ‘Add Facebook pixel code to cart and/or Thank You page’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso