How to add Google Adwords Conversion Tracker code in ExpressionEngine

This is how you can add Google Adwords Conversion Tracker script in ExpressionEngine. First look up where your footer.php is placed in the filesystem. In my case it was ee_companyname/templates/_includes/footer.php

In the file you have to add a condition based on the URI. In ExpressionEngine you have a special kind of script and not regular PHP as you can see below. Segments of the path is stored in the variables like segement_[n]. In my case the condition was that the first part of the path should be tilaa-netin-kautta/kiitos to execute the conversion script.

<?php
{if segment_1=="tilaa-netin-kautta" && segment_2=="kiitos"}
    <
script type="text/javascript">
   
/* <![CDATA[ */
   
var google_conversion_id = [your id code of digits];
    var
google_conversion_language = "fi";
    var
google_conversion_format = "2";
    var
google_conversion_color = "ffffff";
    var
google_conversion_label = "[your label code]";
    var
google_conversion_value = 0;
    if (
5,00) {
     
google_conversion_value = 5,00;
    }
   
/* ]]> */
   
</script>
    <script type="text/javascript" src="<a href="https://www.googleadservices.com/pagead/conversion.js">
">https://www.googleadservices.com/pagead/conversion.js">
</a>    </script>
    <noscript>
    <div style="display:inline;">
    <img height="1" width="1" style="border-style:none;" alt="" src="<a href="https://www.googleadservices.com/pagead/conversion/[your">https://www.googleadservices.com/pagead/conversion/[your</a> id code of digits]/?value=5,00&amp;label=[your label code]&amp;guid=ON&amp;script=0"/>
    </div>
    </noscript>
{/if}
?>
Knowledge keywords: