Page 1 of 1

Add Google conversion code, why not working in OC2.x?

Posted: Mon Mar 16, 2015 5:56 am
by Plugje
I want to add a Google conversion code in the success page. But somehow this is not working anymore in OpenCart 2.x and I don't understand why.
This is the code I want to add at the bottom of the catalog/view/theme/default/template/common/success.tpl:

Code: Select all

<?php if (isset($this->request->get['route']) && $this->request->get['route'] == 'checkout/success') { ?>
    <!-- Conversion Code -->
    <script type="text/javascript">
    var google_conversion_id = 123456789;
    var google_conversion_language = "en";
    var google_conversion_format = "2";
    var google_conversion_color = "ffffff";
    var google_conversion_label = "AAAAAAAAAAAAAAAAAAA";
    var google_conversion_value = 0;
    </script>
    <script type="text/javascript" src="https://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/123456789/?label=AAAAAAAAAAAAAAAAAAA&guid=ON&script=0"/>
    </div>
    </noscript>
    <?php } ?>
Can somebody help me with this?

Re: Add Google conversion code, why not working in OC2.x?

Posted: Wed Apr 08, 2015 6:20 am
by DBI
$this->request->get['route']
This is not populated (from the perspective of the success template) in OC 2.x