Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Dynamic Remarketing Rate Topic   * * * * * 1 votes

 
  • akistdm
  • Senior Member
  • Trial users
  • Join Date: 09-Oct 11
  • 230 posts

Posted 08 April 2014 - 08:03 PM #1

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

<script type="text/javascript">
var google_tag_params = {
ecomm_prodid: 'REPLACE_WITH_VALUE',
ecomm_pagetype: 'REPLACE_WITH_VALUE',
ecomm_totalvalue: 'REPLACE_WITH_VALUE'
};
</script>

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

 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11291 posts

Posted 09 April 2014 - 12:51 AM #2

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):
<script type="text/javascript">
var google_tag_params = {literal}{{/literal}
ecomm_prodid: '{$product.product_id}',
ecomm_pagetype: 'REPLACE_WITH_VALUE',
ecomm_totalvalue: '{$product.price}'
{literal}}{/literal};
</script>

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • akistdm
  • Senior Member
  • Trial users
  • Join Date: 09-Oct 11
  • 230 posts

Posted 09 April 2014 - 04:31 AM #3

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?

 
  • dvsgr
  • Senior Member
  • Authorized Reseller
  • Join Date: 14-Apr 09
  • 1448 posts

Posted 09 April 2014 - 07:34 AM #4

Hi

I would go with something like this

<script type="text/javascript"> {literal}
var google_tag_params ={


if ($params['dispatch'] == 'products.view' && !empty($_REQUEST['product_id'])) {

ecomm_prodid: '{$product.product_id}',
ecomm_pagetype: 'product',
ecomm_totalvalue: '{$product.price}'
}

elseif ($params['dispatch'] == 'index.index' ) {ecomm_pagetype: 'homepage', }

elseif ($params['dispatch'] == 'categories.view' && !empty($_REQUEST['category_id'])) {ecomm_pagetype: 'category', }

elseif ($params['dispatch'] == 'pages.view' && !empty($_REQUEST['page_id'])) {ecomm_pagetype: 'page',}

};
{/literal}
</script>


Just an idea not tested
Fotis
Fotis Kourmadas
Cs-Cart Development - Cs-Cart Authorized Reseller 

 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11291 posts

Posted 09 April 2014 - 08:24 PM #5

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.

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • akistdm
  • Senior Member
  • Trial users
  • Join Date: 09-Oct 11
  • 230 posts

Posted 10 April 2014 - 06:07 AM #6

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.

 
  • Offline
  • Member
  • Members
  • Join Date: 13-Oct 09
  • 85 posts

Posted 19 May 2014 - 08:32 PM #7

Hi

I would go with something like this

<script type="text/javascript"> {literal}
var google_tag_params ={


if ($params['dispatch'] == 'products.view' && !empty($_REQUEST['product_id'])) {

ecomm_prodid: '{$product.product_id}',
ecomm_pagetype: 'product',
ecomm_totalvalue: '{$product.price}'
}

elseif ($params['dispatch'] == 'index.index' ) {ecomm_pagetype: 'homepage', }

elseif ($params['dispatch'] == 'categories.view' && !empty($_REQUEST['category_id'])) {ecomm_pagetype: 'category', }

elseif ($params['dispatch'] == 'pages.view' && !empty($_REQUEST['page_id'])) {ecomm_pagetype: 'page',}

};
{/literal}
</script>


Just an idea not tested
Fotis


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
Chris Edwards

 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11291 posts

Posted 19 May 2014 - 09:22 PM #8

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".

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19285 posts

Posted 20 May 2014 - 08:22 AM #9

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


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

GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • Offline
  • Member
  • Members
  • Join Date: 13-Oct 09
  • 85 posts

Posted 20 May 2014 - 04:03 PM #10

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...

<script type="[url=""]text/javascript[/url]">
var google_tag_params = {
ecomm_prodid: [&#039;AR-540015&#039;,&#039;AR-540013&#039;],
ecomm_pagetype: 'cart',
ecomm_totalvalue: '13.97',
};
</script>

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

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

Thanks,

Chris Edwards
Chris Edwards

 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11291 posts

Posted 20 May 2014 - 09:44 PM #11

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

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19285 posts

Posted 21 May 2014 - 07:22 AM #12

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...

<script type="[url=""]text/javascript[/url]">
var google_tag_params = {
ecomm_prodid: [&#039;AR-540015&#039;,&#039;AR-540013&#039;],
ecomm_pagetype: 'cart',
ecomm_totalvalue: '13.97',
};
</script>

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

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

Thanks,

Chris Edwards


Please use:

{$smarty.capture.cart_order_info nofilter}

and

{$smarty.capture.checkout_order_info nofilter}

Thanks

GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • Offline
  • Member
  • Members
  • Join Date: 13-Oct 09
  • 85 posts

Posted 21 May 2014 - 02:36 PM #13

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'}
{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}

{literal}
<!-- Google Code for Remarketing Tag -->
<!--------------------------------------------------
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
--------------------------------------------------->

<script type="text/javascript">
var google_tag_params = {
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}

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}',
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}',
};
</script>

<script type="text/javascript">
/* <![CDATA[ */
var google_conversion_id = XXXXXXXXXXX;
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/XXXXXXXXXXXX/?value=0&amp;guid=ON&amp;script=0"/>
</div>
</noscript>
{/literal}
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.

I believe this part of the code is not working on the order complete page.

{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}

Which is giving me no products when run....

<script type="[url=""]text/javascript[/url]">
var google_tag_params = {
ecomm_prodid: [],
ecomm_pagetype: 'purchase',
ecomm_totalvalue: '10.98',
};
</script>

Chris Edwards

 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19285 posts

Posted 21 May 2014 - 02:58 PM #14

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.


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

GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • Offline
  • Member
  • Members
  • Join Date: 13-Oct 09
  • 85 posts

Posted 21 May 2014 - 03:21 PM #15

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


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

 
  • Offline
  • Member
  • Members
  • Join Date: 13-Oct 09
  • 85 posts

Posted 21 May 2014 - 03:22 PM #16

{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.products item="item" name="products"}

'{$item.product_code}'{if not $smarty.foreach.products.last},{/if}

{/foreach}

{/capture}

{/if}



{literal}

<!-- Google Code for Remarketing Tag -->

<!--------------------------------------------------

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

--------------------------------------------------->



<script type="text/javascript">

var google_tag_params = {

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}



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}',

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}',

};

</script>



<script type="text/javascript">

/* <![CDATA[ */

var google_conversion_id = XXXXXXXXXXX;

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/XXXXXXXXXXXX/?value=0&amp;guid=ON&amp;script=0"/>

</div>

</noscript>

{/literal}

Chris Edwards

 
  • akistdm
  • Senior Member
  • Trial users
  • Join Date: 09-Oct 11
  • 230 posts

Posted 21 May 2014 - 03:57 PM #17

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.

 
  • samsam92
  • Member
  • Members
  • Join Date: 24-Sep 07
  • 45 posts

Posted 25 July 2014 - 07:53 PM #18

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

 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19285 posts

Posted 28 July 2014 - 07:14 AM #19

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


Try this code:

{if $controller eq 'checkout' && $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 $controller eq 'checkout' && $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}

{literal}
<!-- Google Code for Remarketing Tag -->
<!--------------------------------------------------
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
--------------------------------------------------->

<script type="text/javascript">
var google_tag_params = {
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}

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}',
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}',
};
</script>

<script type="text/javascript">
/* <![CDATA[ */
var google_conversion_id = XXXXXXXXXXX;
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/XXXXXXXXXXXX/?value=0&amp;guid=ON&amp;script=0"/>
</div>
</noscript>
{/literal}

GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • mazter
  • Senior Member
  • Members
  • Join Date: 04-Apr 12
  • 275 posts

Posted 12 September 2014 - 08:44 AM #20

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

/* <![CDATA[ */


is being replaced as


//<![CDATA[

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