Support

Home Forums Event Espresso Premium Facebook conversion value and Adwords conversion value

Facebook conversion value and Adwords conversion value

Posted: February 6, 2017 at 12:59 pm


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

  • Support Staff

February 7, 2017 at 10:03 am

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

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

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( ); ?>&currency_code=EUR&label=XXX&guid=ON&script=0"/>
				</div>
				</noscript>

		        <?php
			}
		}
        
    }   
}
add_action( 'wp_footer', 'ee_add_javascript_thank_you' );


Garth

  • Support Staff

February 7, 2017 at 2:10 pm

Thank you for sharing!

The support post ‘Facebook conversion value and Adwords conversion value’ 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.

Support forum for Event Espresso 3 and Event Espresso 4.
Documentation for EE3 and EE4
Documentation for Event Espresso 3

Documentation for Event Espresso 4

Status: closed

Updated by  Garth 2 years, 6 months ago ago

Topic Tags

Notifications

This topic is: not resolved
Do NOT follow this link or you will be banned from the site!