Wondering how you can add a JotUrl conversion tracking code to your WooCommerce Thank-You-Page?
Well, with the following simple snippet (and no plugin) you can ;)
add_action( 'woocommerce_thankyou', 'joturl_conversion_tracking_thank_you_page' );
function joturl_conversion_tracking_thank_you_page( $order_id ) {
$order = new WC_Order( $order_id );
$value = $order->get_total();
?>
<!-- just copy and paste the JotUrl conversion code here -->
<?php
}
Replace <!-- just copy and paste the JotUrl conversion code here --> with the conversion code you can find on the conversions page. Click the edit icon next to the conversion you want to use, scroll down the dialog and copy the conversion code.
The PHP snippet should look something like this:
add_action( 'woocommerce_thankyou', 'joturl_conversion_tracking_thank_you_page' );
function joturl_conversion_tracking_thank_you_page( $order_id ) {
$order = new WC_Order( $order_id );
$value = $order->get_total();
?>
<script type='text/javascript'>
var joturl_conversion_id = '0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF';
var joturl_conversion_value = '<?php echo $value; ?>';
var joturl_conversion_commission = '0';
var joturl_conversion_param = '';
var joturl_domain_value = 'www.joturl.com';
</script>
<script type='text/javascript' src='https://static.joturl.com/js/conversion.js'></script>
<noscript>
<img height='0' width='0' alt='' src='https://www.joturl.com/c/?id=0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF&val=<?php echo $value; ?>&comm=0¶m='/>
</noscript>
<?php
}
You can place PHP snippets at the bottom of your child theme functions.php file (before "?>" if you have it).
CSS, on the other hand, goes in your child theme style.css file.
Make sure you've full control on what you are doing when editing such delicate files, in doubt, please contact your developer.
For further details please navigate to WooCommerce documentation.
Comments
0 comments
Article is closed for comments.