Google conversion codes

Can someone tell me what is the preferred method for adding a conversion code to the page that appears immediately after a customer confirms payment? I realize that this is probably a dynamically-generated page, and I don’t know the name.

Thanks if you can help.

This might help you out:

[url]CS-Cart Documentation — CS-Cart 4.15.x documentation

I’m not sure if you need to, but I had to put my conversion code inside {literal}{/literal} tags in my confirmation.override.tpl page that I made.

Hope that helps,


The KB is confusing since the only address problems between 2.1.0 and 2.1.1 and then the older releases.

For 2.1.x add the file


and put your changes in there.

For 2.0 use:


If the code that you are pasting in has any ‘{’ or ‘}’ in it then you will need to bracket it with



But normally you are going to want to use template variables in the code to send appropriate order values to the conversion tracker. In this case, replace any ‘{’ characters with ‘{ldelim}’ and any ‘}’ characters with ‘{rdelim}’.

Well that does make a lot more sense than the knowledge base.

Thanks for following me up on that one Tony, you did a lot better job.


So as a novice, I’m presuming that the .tpl page will have something more on it than the Google conversion code, at least judging by the appearance of any other .tpl page I’ve examined. Since the page is a new page and not edited from an existing page, it would be helpful to know how to code the entire page. Or do I just plunk the conversion code on there as outlined above and save it?

Thanks a million.

This is what my:


Looks like:

```php {literal}

{/literal} ```

I replaced some of the data with x's for this demonstration, but it should give you the idea.

Hope that helps,


Thanks so very much. I’ll give that a whirl. If yours works, then I’m sure mine will as well.


So I have added our Google Conversion script to a newly created order_confirmation.override.tpl that I put into the proper folder, but I have a couple of questions:

  1. Brandon, it looks like you used the “http” from Google and not the “https”. Doesn't CS end with a https meaning we would need to use that for our conversion?

  2. Once I create the order_confirmation.override.tpl do I need to some how plant something some place else so the site knows to look for it?

  3. This also sounds like one of those cases that I would need to “clear cache”. Is this the case?

Don't use override unless you have a reason to do so (all cases, not just this one). Use instead.

If you are adding the file then you need to clear your cache. If you're editing an existing file, then you don't.

You should be out of the cart by the time this is run. Hence unless you have https set for the whole site, you would want to use http to have your browser load the google script(s).

Thanks for the help!

Do I just rename the override to “” or do I need to find this file you mentioned some place else on the site?

Conversion tracking code added in this way will produce inaccurate results (at least on 2.0x but I assume also on 2.1x)

This is because of CS-Cart Checkout Process. CS-Cart does some things very well and other things I’m wondering who was smoking what when they designed it.

On most E-Commerce sites, if the credit card fails authorization, an order is not created. On CS-Cart, the order is still created with a Status of declined. If you implement the conversion code this way, a declined order will still create a conversion on the Google side.

I would expect most CS-Cart sites would appear the same way as our site in that if you look at order history, from time to time you will see a declined order, followed by an approved order of the exact same amount but they are still two separate orders. This is from the user using the Re-order button instead of trying to post payment on the existing order. This is a significant drawback of CS-Cart in my opinion. I’m not sure if they addressed it in 2.1 (we are still on the last version of 2.0x)

I will acknowledge that Amazon does it this way. You can submit an order and not until several minutes later will Amazon send you an e-mail that your payment failed and you need to login and re-submit payment. But most sites, it works best to not create the order (and the conversion) when the credit card is declined.

If you want to implement it where it won’t create a conversion for a declined credit card (at least on 2.0x) you need to edit the customer/views/orders/details.tpl Near the end of the file you will see:

{if $smarty.request.confirmation == “Y”} {* place any code you wish to display on this page right after the order has been placed *}

{hook name=“orders:confirmation”}

Between the hook directives you need to add an if statement:

{if $order_info.status != ‘D’}

Then add your conversion code


Here’s an example of the conversion code where the order amount will pass to google (notice two sets of {literal} directives) Literal might not be required but typically Smarty will choke if you don’t use it:



In addition to checking for Declined (D) status, you should also look for Failed (F) status. A communication error (bad password, other credentials, etc.) will generate an 'F' status and you don't want to track conversions on failures either.

Apparently, these instructions are not valid anymore, as I cannot find "if $smarty.request.confirmation == “Y” in my code.

Does Google Conversion Code still go in the details.tpl file, or somewhere else?

Thanks for anyone's help!

I am using the Version 3.0.2 and just wondering what the file name should be for the Thank you Page .tpl file. or order_confirmation.override.tpl ? My Adwords conversions are not showing up at all.