How to guide to get google adwords to work with your prestashop

After googling I couldn’t find any guide to get this to work. I had to piece together bunch of posts and spent a whole night of trial and error came up with this.

In order-confirmation.tpl add to the bottom and fill out your variables from your google adwords

<!-- Google Code for Purchase Conversion Page -->
<script type="text/javascript">
{literal} /* <![CDATA[ */ {/literal}
var google_conversion_id = ENTER_YOUR_ID_HERE;
var google_conversion_language = "en";
var google_conversion_format = "2";
var google_conversion_color = "ffffff";
var google_conversion_label = "ENTER_YOUR_LABEL_HERE";
var google_conversion_value = {$total_pay};
var google_conversion_currency = "{$currencyiso}";
var google_remarketing_only = false;
{literal}/* ]]>*/ {/literal}
</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/ENTER_YOUR_ID_HERE/?value={$total_pay}&amp;currency_code={$currencyiso}&amp;label=ENTER_YOUR_LABEL_HERE&amp;guid=ON&amp;script=0"/>
</div>
</noscript>

inĀ OrderConfirmationController.php add below in initContent function

        public function initContent()
        {
                parent::initContent();

                $this->context->smarty->assign(array(
                        'is_guest' => $this->context->customer->is_guest,
                        'HOOK_ORDER_CONFIRMATION' => $this->displayOrderConfirmation(),
                        'HOOK_PAYMENT_RETURN' => $this->displayPaymentReturn()
                ));


$order = new Order($this->id_order);
$currency = new Currency($order->id_currency);
$this->context->smarty->assign(array(
'total_pay' => $order->getOrdersTotalPaid(),
'currencyiso' => $currency->iso_code
));
                if ($this->context->customer->is_guest)
                {

to test if this is working I used the google tag assistant chrome extension and made a bunch of orders using bankwire payment method.

Good luck….

 

 

https://www.prestashop.com/forums/topic/444305-how-to-guide-to-get-google-adwords-to-work-with-your-prestashop/

Leave a Reply