Dynamic Remarketing

Can someone please help me with the parametrs that the dynamic remarketing tag has?


```php


```



What exactly i have to write in the "REPLACE WITH VALUE''?

What page is this supposed to be on?

2 of the 3 are easy but no idea what a “pagetype” is intended to be.

Assume (for a product detail page):

```php


```

The code must be on all pages and there is the problem. Google says that page type field must have the value “homepage” when the code is in homepage, “product” when the code is in product page etc. Is there a way to Implement this so that every page take the appropriate value automatic or another way?

Hi



I would go with something like this


```php



```

Just an idea not tested
Fotis

I would probably approach it a bit differently and use a php 'post' controller for each mode to set a template variable called 'google_pagetype' to the appropriate value and then just use it in the script.



But if you want info on a product for the homepage, then you have to ensure that the product is listed on that page and you probably need to know what block it's in to extract the data. And if it's a listing, how do you know which product?



Not a well thought out snippet if you ask me.

I am tryed the code tha Dvs post but google still says no defined parameters. I am trying several things. If I find something I will post it. I just thought that someone in here would use the dynamic remarketing and could help further.

[quote name='dvsgr' timestamp='1397028879' post='181329']

Hi



I would go with something like this


```php



```

Just an idea not tested
Fotis
[/quote]

I am trying to use part of this code to setup goole remarking but when I put {$params['dispatch']} in a smarty template nothing is showing up. Is this the correct code to find out what location I am on? I was using {if $controller eq 'products'}'{$product.product_code} in v2.24 but it seems to not work in 4.1.3.

Thanks!

Chris Edwards

I think you would want to replace “$params['dispatch']” with “$smarty.request.dispatch”, but it's possible the templater is putting the PHP $_REQUEST variable into “$params”.

[quote name='Offline' timestamp='1400531559' post='183826']

I am trying to use part of this code to setup goole remarking but when I put {$params['dispatch']} in a smarty template nothing is showing up. Is this the correct code to find out what location I am on? I was using {if $controller eq 'products'}'{$product.product_code} in v2.24 but it seems to not work in 4.1.3.



Thanks!



Chris Edwards

[/quote]



You should use {$runtime.controller} and {$runtime.mode} in the latest versions of CS-Cart.

I about have this figured out. I am now only running into one problem.



When this code runs…


{if $runtime.controller eq 'checkout' && $runtime.mode ne 'complete'}
{capture name="cart_order_info"}
{foreach from=$cart_products item="item" name="products"}
'{$item.product_code}'{if not $smarty.foreach.products.last},{/if}
{/foreach}
{/capture}
{/if}

{if $runtime.controller eq 'checkout' && $runtime.mode eq 'complete'}
{capture name="checkout_order_info"}
{foreach from=$order_info.items item="item" name="products"}
'{$item.product_code}'{if not $smarty.foreach.products.last},{/if}
{/foreach}
{/capture}
{/if}




I get these results…






The problem is that the apostrophe's listed under ecomm_prodid: are being converted to ' .



Any idea how to get CS-Cart / Smarty to no convert the ' ?



Thanks,



Chris Edwards

Get rid of them in your capture and add them in your javascript.

[quote name='Offline' timestamp='1400601836' post='183897']

I about have this figured out. I am now only running into one problem.



When this code runs…


{if $runtime.controller eq 'checkout' && $runtime.mode ne 'complete'}
{capture name="cart_order_info"}
{foreach from=$cart_products item="item" name="products"}
'{$item.product_code}'{if not $smarty.foreach.products.last},{/if}
{/foreach}
{/capture}
{/if}

{if $runtime.controller eq 'checkout' && $runtime.mode eq 'complete'}
{capture name="checkout_order_info"}
{foreach from=$order_info.items item="item" name="products"}
'{$item.product_code}'{if not $smarty.foreach.products.last},{/if}
{/foreach}
{/capture}
{/if}




I get these results…






The problem is that the apostrophe's listed under ecomm_prodid: are being converted to ' .



Any idea how to get CS-Cart / Smarty to no convert the ' ?



Thanks,



Chris Edwards

[/quote]



Please use:



{$smarty.capture.cart_order_info nofilter}




and



{$smarty.capture.checkout_order_info nofilter}




Thanks

Ok, I have finished the Google Remarketing Code that I am using for version 4.1.3 of CS-Cart. I created a block with smarty & html and called it google remarketing. Then pasted the following code into. Make sure you set your conversion “google_conversion_id”.


{if $runtime.controller eq 'checkout' && $runtime.mode ne 'complete'}<br />
{capture name="cart_order_info"}<br />
{foreach from=$cart_products item="item" name="products"}<br />
'{$item.product_code}'{if not $smarty.foreach.products.last},{/if}<br />
{/foreach}<br />
{/capture}<br />
{/if}<br />
<br />
{if $runtime.controller eq 'checkout' && $runtime.mode eq 'complete'}<br />
{capture name="checkout_order_info"}<br />
{foreach from=$order_info.items item="item" name="products"}<br />
'{$item.product_code}'{if not $smarty.foreach.products.last},{/if}<br />
{/foreach}<br />
{/capture}<br />
{/if}<br />
<br />
{literal}<br />
<!-- Google Code for Remarketing Tag --><br />
<!--------------------------------------------------<br />
Remarketing tags may not be associated with personally identifiable information or placed on pages related to sensitive categories. See more information and instructions on how to setup the tag on: http://google.com/ads/remarketingsetup<br />
---------------------------------------------------><br />
<br />
<script type="text/javascript"><br />
var google_tag_params = {<br />
ecomm_prodid: {/literal}{if $runtime.controller eq 'products'}'{$product.product_code}',{elseif $runtime.controller eq 'checkout' && $runtime.mode ne 'complete'}[{$smarty.capture.cart_order_info nofilter}],{elseif $runtime.controller eq 'checkout' && $runtime.mode eq 'complete'}[{$smarty.capture.checkout_order_info nofilter}],{else}'',{/if}{literal}<br />
<br />
ecomm_pagetype: '{/literal}{if $runtime.controller eq 'index'}home{elseif $runtime.controller eq 'categories'}category{elseif $runtime.controller eq 'products'}product{elseif $runtime.controller eq 'checkout' && $runtime.mode eq 'complete'}purchase{elseif $runtime.controller eq 'checkout' && $runtime.mode ne 'complete'}cart{else}siteview{/if}{literal}',<br />
ecomm_totalvalue: '{/literal}{if $runtime.controller eq 'products'}{$product.price|number_format:2}{elseif $runtime.controller eq 'checkout' && $runtime.mode eq 'complete'}{$order_info.subtotal|number_format:2}{elseif $runtime.controller eq 'checkout' && $runtime.mode ne 'complete'}{$cart.subtotal|number_format:2}{/if}{literal}',<br />
};<br />
</script><br />
<br />
<script type="text/javascript"><br />
/* <![CDATA[ */<br />
var google_conversion_id = XXXXXXXXXXX;<br />
var google_custom_params = window.google_tag_params;<br />
var google_remarketing_only = true;<br />
/* ]]> */<br />
</script><br />
<script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js"><br />
</script><br />
<noscript><br />
<div style="display:inline;"><br />
<img height="1" width="1" style="border-style:none;" alt="" src="upload://ux1zSLp9vBY9KEUw7CSvZVrESee.gif"><br />
</div><br />
</noscript><br />
{/literal}
```<br />
The only part that seems to not work is that when you get the the final checkout it doesn't list the products on that were purchased.  I am not sure how to fix it.<br />
<br />
I believe this part of the code is not working on the order complete page.<br />
<br />
```php
{if $runtime.controller eq 'checkout' && $runtime.mode eq 'complete'}<br />
{capture name="checkout_order_info"}<br />
{foreach from=$order_info.items item="item" name="products"}<br />
'{$item.product_code}'{if not $smarty.foreach.products.last},{/if}<br />
{/foreach}<br />
{/capture}<br />
{/if}
```<br />
<br />
Which is giving me no products when run....<br />
<br />
```php
<script type="[url=""]text/javascript[/url]"><br />
var google_tag_params = {<br />
ecomm_prodid: [],<br />
ecomm_pagetype: 'purchase',<br />
ecomm_totalvalue: '10.98',<br />
};<br />
</script>

[quote name='Offline' timestamp='1400683000' post='183987']

The only part that seems to not work is that when you get the the final checkout it doesn't list the products on that were purchased. I am not sure how to fix it.

[/quote]



In the latest versions you should use $order_info.products instead of the $order_info.items . Please try.

[quote name='eComLabs' timestamp='1400684285' post='183993']

In the latest versions you should use $order_info.products instead of the $order_info.items . Please try.

[/quote]



That worked perfect! i'll repost the code one last time.

{if $runtime.controller eq 'checkout' && $runtime.mode ne 'complete'}<br />
{capture name="cart_order_info"}<br />
{foreach from=$cart_products item="item" name="products"}<br />
'{$item.product_code}'{if not $smarty.foreach.products.last},{/if}<br />
{/foreach}<br />
{/capture}<br />
{/if}<br />
<br />
{if $runtime.controller eq 'checkout' && $runtime.mode eq 'complete'}<br />
{capture name="checkout_order_info"}<br />
{foreach from=$order_info.products item="item" name="products"}<br />
'{$item.product_code}'{if not $smarty.foreach.products.last},{/if}<br />
{/foreach}<br />
{/capture}<br />
{/if}<br />
<br />
{literal}<br />
<!-- Google Code for Remarketing Tag --><br />
<!--------------------------------------------------<br />
Remarketing tags may not be associated with personally identifiable information or placed on pages related to sensitive categories. See more information and instructions on how to setup the tag on: http://google.com/ads/remarketingsetup<br />
---------------------------------------------------><br />
<br />
<script type="text/javascript"><br />
var google_tag_params = {<br />
ecomm_prodid: {/literal}{if $runtime.controller eq 'products'}'{$product.product_code}',{elseif $runtime.controller eq 'checkout' && $runtime.mode ne 'complete'}[{$smarty.capture.cart_order_info nofilter}],{elseif $runtime.controller eq 'checkout' && $runtime.mode eq 'complete'}[{$smarty.capture.checkout_order_info nofilter}],{else}'',{/if}{literal}<br />
<br />
ecomm_pagetype: '{/literal}{if $runtime.controller eq 'index'}home{elseif $runtime.controller eq 'categories'}category{elseif $runtime.controller eq 'products'}product{elseif $runtime.controller eq 'checkout' && $runtime.mode eq 'complete'}purchase{elseif $runtime.controller eq 'checkout' && $runtime.mode ne 'complete'}cart{else}siteview{/if}{literal}',<br />
ecomm_totalvalue: '{/literal}{if $runtime.controller eq 'products'}{$product.price|number_format:2}{elseif $runtime.controller eq 'checkout' && $runtime.mode eq 'complete'}{$order_info.subtotal|number_format:2}{elseif $runtime.controller eq 'checkout' && $runtime.mode ne 'complete'}{$cart.subtotal|number_format:2}{/if}{literal}',<br />
};<br />
</script><br />
<br />
<script type="text/javascript"><br />
/* <![CDATA[ */<br />
var google_conversion_id = XXXXXXXXXXX;<br />
var google_custom_params = window.google_tag_params;<br />
var google_remarketing_only = true;<br />
/* ]]> */<br />
</script><br />
<script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js"><br />
</script><br />
<noscript><br />
<div style="display:inline;"><br />
<img height="1" width="1" style="border-style:none;" alt="" src="upload://ux1zSLp9vBY9KEUw7CSvZVrESee.gif"><br />
</div><br />
</noscript><br />
{/literal}

That was fantastic!!!

Thanks a lot for helping.

My only problem now is the images that cannot be crawled in merchant.

I added the
User-agent: Googlebot-image
Disallow:
in robots.txt but still nothing.

Thanks a lot for sharing.



We're using CS 3.0.2 and was wondering how to reformulate the code from Offline #16 to make it work on it?



Willing to pay for help.



Thank you

[quote name=‘samsam92’ timestamp=‘1406318017’ post=‘188219’]

Thanks a lot for sharing.



We’re using CS 3.0.2 and was wondering how to reformulate the code from Offline #16 to make it work on it?



Willing to pay for help.



Thank you

[/quote]



Try this code:


<br />
{if $controller eq 'checkout' && $mode ne 'complete'}<br />
{capture name="cart_order_info"}<br />
{foreach from=$cart_products item="item" name="products"}<br />
'{$item.product_code}'{if not $smarty.foreach.products.last},{/if}<br />
{/foreach}<br />
{/capture}<br />
{/if}<br />
<br />
{if $controller eq 'checkout' && $mode eq 'complete'}<br />
{capture name="checkout_order_info"}<br />
{foreach from=$order_info.items item="item" name="products"}<br />
'{$item.product_code}'{if not $smarty.foreach.products.last},{/if}<br />
{/foreach}<br />
{/capture}<br />
{/if}<br />
<br />
{literal}<br />
<!-- Google Code for Remarketing Tag --><br />
<!--------------------------------------------------<br />
Remarketing tags may not be associated with personally identifiable information or placed on pages related to sensitive categories. See more information and instructions on how to setup the tag on: http://google.com/ads/remarketingsetup<br />
---------------------------------------------------><br />
<br />
<script type="text/javascript"><br />
var google_tag_params = {<br />
ecomm_prodid: {/literal}{if $controller eq 'products'}'{$product.product_code}',{elseif $controller eq 'checkout' && $mode ne 'complete'}[{$smarty.capture.cart_order_info}],{elseif $controller eq 'checkout' && $mode eq 'complete'}[{$smarty.capture.checkout_order_info}],{else}'',{/if}{literal}<br />
<br />
ecomm_pagetype: '{/literal}{if $controller eq 'index'}home{elseif $controller eq 'categories'}category{elseif $controller eq 'products'}product{elseif $controller eq 'checkout' && $mode eq 'complete'}purchase{elseif $controller eq 'checkout' && $mode ne 'complete'}cart{else}siteview{/if}{literal}',<br />
ecomm_totalvalue: '{/literal}{if $controller eq 'products'}{$product.price|number_format:2}{elseif $controller eq 'checkout' && $mode eq 'complete'}{$order_info.subtotal|number_format:2}{elseif $controller eq 'checkout' && $mode ne 'complete'}{$cart.subtotal|number_format:2}{/if}{literal}',<br />
};<br />
</script><br />
<br />
<script type="text/javascript"><br />
/* <![CDATA[ */<br />
var google_conversion_id = XXXXXXXXXXX;<br />
var google_custom_params = window.google_tag_params;<br />
var google_remarketing_only = true;<br />
/* ]]> */<br />
</script><br />
<script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js"><br />
</script><br />
<noscript><br />
<div style="display:inline;"><br />
<img height="1" width="1" style="border-style:none;" alt="" src="upload://ux1zSLp9vBY9KEUw7CSvZVrESee.gif"><br />
</div><br />
</noscript><br />
{/literal}<br />

eComLabs, that was great help, thank you for the assistance. Looks like with the newest CSCart version,



[color=#008800]/*




is being replaced as





//


This is preventing Google to recognize their code on the website. What is the best way to be able to include the code to show on the wewbsite “as is” ?



Thank you