RomuGb Posted March 11, 2014 Share Posted March 11, 2014 Hi everyone ! i have been searching hard to add the remarketing google script in prestashop 1.5.3 : Here is my solution, hope this will help many !!! In /httpdocs/themes/yourtheme/footer.tpl At the end of the code, just before </body> : <!-- google remarketing script --> <script type='text/javascript'> var google_tag_params = { {if $page_name == 'index'} ecomm_pagetype: 'home' {elseif $page_name == 'order'} ecomm_prodid: [{foreach from=$products item=product name=prodid}'{$product.id_product}'{if $smarty.foreach.prodid.last}{else},{/if}{/foreach}], ecomm_pagetype: 'cart', ecomm_totalvalue: '{convertPrice price=$cart->getOrderTotal(true)}' {elseif $page_name == 'product'} ecomm_prodid: '{$product->id}', ecomm_pagetype: 'product', ecomm_totalvalue: '{$product->getPrice(false, $smarty.const.NULL, $priceDisplayPrecision)}' {elseif $page_name == 'order-confirmation'} ecomm_pagetype: 'purchase', ecomm_totalvalue: '{$total_to_pay}' {elseif $page_name == 'category'} ecomm_pagetype: 'category' {else} {/if} }; </script> {literal} <script type="text/javascript"> /* <![CDATA[ */ var google_conversion_id = xxxx mettre ici votre code xxxxxx; var google_custom_params = window.google_tag_params; var google_remarketing_only = true; /* ]]> */ </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="//googleads.g.doubleclick.net/pagead/viewthroughconversion/xxxxmettre_ici_votre code_xxxxxx/?value=0&guid=ON&script=0"/> </div> </noscript> {/literal} </body> </html> In /httpdocs/controllers/front/OrderConfirmationController.php (Its better to add this in the override OrderConfirmationController.php but i dont know how to do it, if i could have some help on this ?) 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() )); if ($this->context->customer->is_guest) { $this->context->smarty->assign(array( 'id_order' => $this->id_order, 'reference_order' => $this->reference, 'id_order_formatted' => sprintf('#%06d', $this->id_order), 'email' => $this->context->customer->email )); /* If guest we clear the cookie for security reason */ $this->context->customer->mylogout(); } /* google remarketing */ $order = new Order($this->id_order); $cart = new Cart($order->id_cart); $this->context->smarty->assign(array( 'total_to_pay'=>$order->getOrdersTotalPaid() )); /* google remarketing */ $this->setTemplate(_PS_THEME_DIR_.'order-confirmation.tpl'); } Enjoy !!! 5 Link to comment Share on other sites More sharing options...
ajnglagla Posted April 22, 2014 Share Posted April 22, 2014 if you want to see the prices right, this code {$product->getPrice(false, $smarty.const.NULL, $priceDisplayPrecision)} must be chaged to {$product->getPrice(true, $smarty.const.NULL, $priceDisplayPrecision)} Link to comment Share on other sites More sharing options...
ajnglagla Posted April 22, 2014 Share Posted April 22, 2014 and also you may need to LANG ISO CODE after your product id. (ex: "473-tr") 1 Link to comment Share on other sites More sharing options...
Dh42 Posted April 22, 2014 Share Posted April 22, 2014 There is a module by business tech that does the remarketing code automatically. Link to comment Share on other sites More sharing options...
Alexgaw Posted May 8, 2014 Share Posted May 8, 2014 Hi, I cannot get re marketing to work on PS1.606. Google chrome tag assistant give this error. Error: No HTTP response detected Have any of you got hit thing working on 1.606? Cheers, /Alex Link to comment Share on other sites More sharing options...
criacaosites Posted May 20, 2014 Share Posted May 20, 2014 I have same error no http, try compress js. In my case don't work because my theme lost configuration of layout. Link to comment Share on other sites More sharing options...
franzneves Posted July 7, 2014 Share Posted July 7, 2014 I have same error no http Link to comment Share on other sites More sharing options...
ajensen27 Posted July 10, 2014 Share Posted July 10, 2014 Code worked perfectly RomuGb.... Thanks!! Link to comment Share on other sites More sharing options...
RomuGb Posted July 11, 2014 Author Share Posted July 11, 2014 Code worked perfectly RomuGb.... Thanks!! Thanks Ajensen27 ! Link to comment Share on other sites More sharing options...
RomuGb Posted July 11, 2014 Author Share Posted July 11, 2014 I have same error no http I have same error no http, try compress js. In my case don't work because my theme lost configuration of layout. Hi, I cannot get re marketing to work on PS1.606. Google chrome tag assistant give this error. Error: No HTTP response detected Have any of you got hit thing working on 1.606? Cheers, /Alex Ok if you find a solution for 1.6 version please post it here. It will help others. Thanks. Romu Link to comment Share on other sites More sharing options...
franzneves Posted July 12, 2014 Share Posted July 12, 2014 I need solution too - 1.6.0.6 Link to comment Share on other sites More sharing options...
ajensen27 Posted July 14, 2014 Share Posted July 14, 2014 (edited) Thanks Ajensen27 ! I spoke to soon I'm getting the following error in my Google Adwords account under the remarketing tool. Any ideas? Your Google Analytics tag is active We haven't detected custom parameters for Retail The tag is active but we couldn't find any custom parameters. Check that the remarketing tag is implemented correctly. Custom parameters are necessary to enable dynamic remarketing. We didn't find the custom parameter "ecomm_prodid" Edited July 14, 2014 by ajensen27 (see edit history) Link to comment Share on other sites More sharing options...
Tia© Posted September 15, 2014 Share Posted September 15, 2014 RomuGb thank you very much!! Very useful solution, thank's again! For override i think you can copy the OrderConfirmationController.php modified file in youshopdirectory/override/classes/ Remember to clean the cache dir /yourshopdir/classes/cache/ Link to comment Share on other sites More sharing options...
mnmak Posted March 29, 2015 Share Posted March 29, 2015 (edited) Enjoy !!! Hello RomuGb, thank you for the great code. It works perfectly, unfortunately it doesnt pass some of the parameters corectly, namely: The tag is not passing all required values for "ecomm_pagetype". I think the problem is for "cart" and "order". Any advice? This is the code: <script type='text/javascript'> var google_tag_params = { {if $page_name == 'index'} ecomm_pagetype: 'home' {elseif $page_name == 'order'} ecomm_prodid: [{foreach from=$products item=product name=prodid}'{$product.id_product}'{if $smarty.foreach.prodid.last}{else},{/if}{/foreach}], ecomm_pagetype: 'cart', ecomm_totalvalue: '{convertPrice price=$cart->getOrderTotal(true)}' {elseif $page_name == 'product'} ecomm_prodid: '{$product->id}', ecomm_pagetype: 'product', ecomm_totalvalue: '{$product->getPrice(true, $smarty.const.NULL, $priceDisplayPrecision)}' {elseif $page_name == 'order-confirmation'} ecomm_pagetype: 'purchase', ecomm_totalvalue: '{$total_to_pay}' {elseif $page_name == 'category'} ecomm_pagetype: 'category' {else} {/if} }; </script> PS 1.6.0.11 Edited March 29, 2015 by mnmak (see edit history) Link to comment Share on other sites More sharing options...
mir-aus Posted May 10, 2015 Share Posted May 10, 2015 There is a module by business tech that does the remarketing code automatically. Hi, I used your module! it doesn't works and also I tray use what exactly "mnmak" said, bust still same error in google: We haven't detected the Google Analytics remarketing functionality on your website any suggestion? I have PS. 1.6.0.6 1 Link to comment Share on other sites More sharing options...
David Niry Posted August 26, 2015 Share Posted August 26, 2015 Guys, whether you are using our module (http://addons.prestashop.com/en/advertising-marketing-newsletter-modules/9736-google-remarketing-dynamic.html), or doing this manually, initially, there will be a wait time during which Adwords will tell you "We haven't detected the Google Analytics remarketing functionality on your website". This is simply because Google needs to crawl all your site and index it again before the tags are detected. Just be patient and it will eventually be fine (it can take from a couple days up to a week or so, depending on the frequency at which Google visits your website). I hope this clears up any confusion. We have used our module for our own remarketing campaigns in the past and went through the exact same thing. After a few days, it worked ! Link to comment Share on other sites More sharing options...
lysybogu Posted October 28, 2015 Share Posted October 28, 2015 Ok if you find a solution for 1.6 version please post it here. It will help others. Thanks. Romu In presta 1.6 You must disable "Move the javascript to the end" option at the BO -> Advanced setting -> Preferences And then retargeting tags works great! 2 Link to comment Share on other sites More sharing options...
Stahoo Posted November 23, 2015 Share Posted November 23, 2015 Hello, thanks for great post, finally some complete tutorail that works. Tested with Prestashop 1.6.1 and it works! Regards Link to comment Share on other sites More sharing options...
Mizi91 Posted January 14, 2016 Share Posted January 14, 2016 PS 1.6.0.11: I use this version of script: <script type='text/javascript'> var google_tag_params = { {if $page_name == 'index'} ecomm_pagetype: 'home' {elseif $page_name == 'order-opc'} ecomm_prodid: [{foreach from=$products item=product name=prodid}'{$product.id_product}'{if $smarty.foreach.prodid.last}{else},{/if}{/foreach}], ecomm_pagetype: 'cart', ecomm_totalvalue: '{convertPrice price=$cart->getOrderTotal(true)}' {elseif $page_name == 'product'} ecomm_prodid: '{$product->id}', ecomm_pagetype: 'product', ecomm_totalvalue: '{$product->getPrice(true, $smarty.const.NULL, $priceDisplayPrecision)}' {elseif $page_name == 'order-confirmation'} ecomm_pagetype: 'purchase', ecomm_totalvalue: '{$total_to_pay}' {elseif $page_name == 'category'} ecomm_pagetype: 'category' {else} {/if} }; </script> But i get error: Number field should not be quoted: 'ecomm_totalvalue' Does anyone know where is the mistake? Link to comment Share on other sites More sharing options...
lysybogu Posted January 14, 2016 Share Posted January 14, 2016 (edited) Mizi91 find every line that cointains ecomm_totalvalue: and delete quotes from there, so e.g. line: ecomm_totalvalue: '{$total_to_pay}' must look like this: ecomm_totalvalue: {$total_to_pay} Edited January 14, 2016 by lysybogu (see edit history) 1 Link to comment Share on other sites More sharing options...
TACS Posted January 15, 2016 Share Posted January 15, 2016 Hello, Thanks for the useful information. I can confirm that I almost have this working, However im having a slight issue with the following google tag assistant reports "some products are not valid" google adwords is telling me the following; Custom parameter "ecomm_prodid" and Merchant Center feed values don't match Values for "ecomm_prodid" should match item identifiers in your Merchant Center feed. The value of the "ecomm_prodid" parameter being passed to the remarketing tag is incorrect. Your tag's "ecomm_prodid" value needs to match either the "id" or "item_group_id" of the product in the connected Google Merchant Center account My Merchant feed "Item Id" is as follows; 101-en, 102-en, 103-en, 104-en, 105-en..... and so on.. when I check the tag assistant the custom parameter reports "ecomm_prodid": "101", I believe the script is communicating just the product id number and not the -en part?? any idea how I can work around this? Link to comment Share on other sites More sharing options...
TACS Posted January 15, 2016 Share Posted January 15, 2016 and also you may need to LANG ISO CODE after your product id. (ex: "473-tr") hello ajnglagla, Can you or anyone else confirm how to do this?... its the solution im looking for in my above post Link to comment Share on other sites More sharing options...
Mizi91 Posted January 16, 2016 Share Posted January 16, 2016 Mizi91 find every line that cointains ecomm_totalvalue: and delete quotes from there, so e.g. line: ecomm_totalvalue: '{$total_to_pay}' must look like this: ecomm_totalvalue: {$total_to_pay} Thank you lysybogu, it works perfectly now :-) Link to comment Share on other sites More sharing options...
TACS Posted January 16, 2016 Share Posted January 16, 2016 Hello, Thanks for the useful information. I can confirm that I almost have this working, However im having a slight issue with the following google tag assistant reports "some products are not valid" google adwords is telling me the following; Custom parameter "ecomm_prodid" and Merchant Center feed values don't match Values for "ecomm_prodid" should match item identifiers in your Merchant Center feed. The value of the "ecomm_prodid" parameter being passed to the remarketing tag is incorrect. Your tag's "ecomm_prodid" value needs to match either the "id" or "item_group_id" of the product in the connected Google Merchant Center account My Merchant feed "Item Id" is as follows; 101-en, 102-en, 103-en, 104-en, 105-en..... and so on.. when I check the tag assistant the custom parameter reports "ecomm_prodid": "101", I believe the script is communicating just the product id number and not the -en part?? any idea how I can work around this? hello ajnglagla, Can you or anyone else confirm how to do this?... its the solution im looking for in my above post SOLVED!: Simply add the country code as follows in bold; ecomm_prodid: '{$product->id}-en', {elseif $page_name == 'product'}ecomm_prodid: '{$product->id}-en', ecomm_pagetype: 'product', ecomm_totalvalue: {$product->getPrice(true, $smarty.const.NULL, $priceDisplayPrecision)} Link to comment Share on other sites More sharing options...
hammer63 Posted May 24, 2016 Share Posted May 24, 2016 Here is my custom code which caculate with the VAT : <script type='text/javascript'> var google_tag_params = { {if $page_name == 'index'} ecomm_pagetype: 'home' {elseif $page_name == 'order'} ecomm_prodid: [{foreach from=$products item=product name=prodid}'{$product.id_product}'{if $smarty.foreach.prodid.last}{else},{/if}{/foreach}], ecomm_pagetype: 'cart', ecomm_totalvalue: {$cart->getOrderTotal(true)} {elseif $page_name == 'cart'} ecomm_prodid: [{foreach from=$products item=product name=prodid}'{$product.id_product}'{if $smarty.foreach.prodid.last}{else},{/if}{/foreach}], ecomm_pagetype: 'cart', ecomm_totalvalue: {$cart->getOrderTotal(true)} {elseif $page_name == 'product'} ecomm_prodid: {$product->id}, ecomm_pagetype: 'product', ecomm_totalvalue: {$product->getPrice(true, $smarty.const.NULL, $priceDisplayPrecision)} {elseif $page_name == 'category'} ecomm_pagetype: 'category' {elseif $page_name == 'order-opc'} ecomm_prodid: [{foreach from=$products item=product name=prodid}'{$product.id_product}'{if $smarty.foreach.prodid.last}{else},{/if}{/foreach}], ecomm_pagetype: 'cart', ecomm_totalvalue: {$cart->getOrderTotal(true)} {elseif $page_name == 'order-confirmation'} ecomm_prodid: [{foreach from=$products item=product name=prodid}'{$product.id_product}'{if $smarty.foreach.prodid.last}{else},{/if}{/foreach}], ecomm_pagetype: 'purchase', ecomm_totalvalue: {$cart->getOrderTotal(true)} {else} ecomm_pagetype: 'other' {/if} }; </script> 1 Link to comment Share on other sites More sharing options...
01generator Posted May 27, 2016 Share Posted May 27, 2016 In presta 1.6 You must disable "Move the javascript to the end" option at the BO -> Advanced setting -> Preferences And then retargeting tags works great! Thank you!! You saved my remaining brain cells Link to comment Share on other sites More sharing options...
Recommended Posts