Biebob
February 6, 2017 at 12:59 pm
Hi,
How can I get the tracking script and correct conversion value on my thank you page of Facebook and Adwords?
Facebook
<script>
fbq(‘track’, ‘ViewContent’, {
value: [VALUE],
currency: ‘EUR’
});
</script>
Adwords
<script type=”text/javascript”>
/* <![CDATA[ */
var google_conversion_id = xxx;
var google_conversion_language = “en”;
var google_conversion_format = “3”;
var google_conversion_color = “ffffff”;
var google_conversion_label = “xxx”;
var google_conversion_value = [VALUE];
var google_conversion_currency = “EUR”;
var google_remarketing_only = false;
/* ]]> */
</script>
Garth
February 7, 2017 at 10:03 am
Add New Note to this Reply
The hooks that are included in the Thanks You page can used to add a tracking pixel of any kind. Here’s a link to a developer guide for using the hooks on Event Espresso 4’s Thank You page:
http://developer.eventespresso.com/tutorial/customizing-the-event-espresso-thank-you-page/
There is another thread on this topic here: https://eventespresso.com/topic/facebook-pixel-code-registration-checkout-and-thank-you-page/
Biebob
February 7, 2017 at 10:09 am
Add New Note to this Reply
Hi,
I found these resources myself. But I did not manage to get the order info into the javascript. Can you give an example?
Biebob
February 7, 2017 at 12:53 pm
Add New Note to this Reply
Hi,
For everyone with this problem. This wil probably work.
function ee_add_javascript_thank_you() {
if ( is_page( 'order-successful' ) ) {
EE_Registry::instance()->load_model( 'Transaction' );
$transaction = EE_Registry::instance()->load_model( 'Transaction' )->get_transaction_from_reg_url_link();
if ( ! $transaction instanceof EE_Transaction ) {
exit();
}
$registrations = $transaction->registrations();
foreach ($registrations as $key => $registration) {
if ( $_REQUEST['e_reg_url_link'] == $registration->reg_url_link() ) {
//echo '<pre>'; print_r($registration); echo '</pre>';
?>
<script>
fbq('track', 'Purchase', {
value: <?php echo $registration->price_paid( ); ?>,
currency: 'EUR'
});
</script>
<!-- Google Code for Tickets Biebob Conversion Page -->
<script type="text/javascript">
/* <![CDATA[ */
var google_conversion_id = XXX;
var google_conversion_language = "en";
var google_conversion_format = "3";
var google_conversion_color = "ffffff";
var google_conversion_label = "XXX";
var google_conversion_value = <?php echo $registration->price_paid( ); ?>;
var google_conversion_currency = "EUR";
var google_remarketing_only = false;
/* ]]> */
</script>
<script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js">
</script>
<noscript>
<div style="display:inline;">
<img height="1" width="1" style="border-style:none;" alt="" src="//www.googleadservices.com/pagead/conversion/XXX/?value=<?php echo $registration->price_paid( ); ?>¤cy_code=EUR&label=XXX&guid=ON&script=0"/>
</div>
</noscript>
<?php
}
}
}
}
add_action( 'wp_footer', 'ee_add_javascript_thank_you' );
Garth
February 7, 2017 at 2:10 pm
Add New Note to this Reply
Thank you for sharing!