I'm trying to add a Google Ads event snippet to a confirmed booking on a hotel booking website. The website is running on Wordpress .
The snippet needs to sit inside the $ord array, which i've been told is like this:
if($ord['status'] == 'confirmed){
// your code
}
However when i try this in my header.php or functions.php file it crashed the site.
if($ord['status'] == 'confirmed){
<script>
gtag('event', 'conversion', {
'send_to': 'AW-712937327/fA8JCJeerakBEO-e-tMC',
'value': 1.0,
'currency': 'GBP',
'transaction_id': ''
});
</script>
<?php } ?>
I'm expecting the code to track when the booking status is changed to 'confirmed'. The result i'm getting at the moment is the website just displays a white screen with the message 'this website is experiencing technical difficulties'
You can try this:
<?php if($ord['status'] == 'confirmed) { ?>
<script>
gtag('event', 'conversion', {
'send_to': 'AW-712937327/fA8JCJeerakBEO-e-tMC',
'value': 1.0,
'currency': 'GBP',
'transaction_id': ''
});
</script>
<?php } ?>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.