Analytics
Phone snippet – Analytics
The phone snippet should be added to the pages on your website where the phone number you’d like to track appears. The phone snippet should be placed right after the global site tag.
<script> gtag('config', 'AW-CONVERSION_ID/CONVERSION_LABEL', { 'phone_conversion_number': '1-650-555-5555' }); </script>
Event snippet – Google Analytics
The event snippet should be installed on the conversion page itself. Google recommends placing it within the
<head>[/php ] section for the best tracking accuracy. [php] <!-- Event snippet for Example conversion page --> <script> gtag('event', 'conversion', {'send_to': 'AW-CONVERSION_ID/CONVERSION_LABEL', 'value': 1.0, 'currency': 'USD' }); </script>
Add Conversion Tracking Code to Thank You Page
/** * @snippet Add Conversion Tracking Code to Thank You Page */ add_action( 'woocommerce_thankyou', 'bbloomer_conversion_tracking_thank_you_page' ); function bbloomer_conversion_tracking_thank_you_page() { ?> <!-- Google Code for Conversion Page --> <script type="text/javascript"> /* <![CDATA[ */ var google_conversion_id = 000000000000; var google_conversion_language = "en"; var google_conversion_format = "3"; var google_conversion_color = "ffffff"; var google_conversion_label = "kjsdhfkjhkfsdfsdf"; 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/000000000000/?label=kjdhfsdjfkjkjshdkkkjsdkk&guid=ON&script=0"/> </div> </noscript> <?php }