Google Adwords Conversion Code - 4.1.4

G’Day All,



Age is getting the better of me and I can’t for the life of me figure the following out:

I’m trying to place the google adwords code into order confirmation page.


/design/themes/basic/templates/views/checkout/complete.tpl
```<br />
<br />
```php
<br />
{* place any code you wish to display on this page right after the order has been placed *}<br />
  {hook name="checkout:order_confirmation"}<br />
   <!-- Google Code for Google Adwords - Purchase Conversion Page --><br />
{literal}  <br />
<script type="text/javascript"><br />
	/* <![CDATA[ */<br />
	var google_conversion_id = 11111111111;<br />
	var google_conversion_language = "en";<br />
	var google_conversion_format = "3";<br />
	var google_conversion_color = "ffffff";<br />
	var google_conversion_label = "1111111111111";<br />
	var google_conversion_value = {/literal}{$order_info.total}{literal};<br />
	var google_conversion_currency = "AUD";<br />
	var google_remarketing_only = false;<br />
	/* ]]> */<br />
	</script><br />
	<script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js"><br />
	</script><br />
<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 />
{/hook}<br />
<br />

Someone has probably used an override for that hook. Best to use a post hook rather than embedding in a distributed template.

[quote name='tbirnseth' timestamp='1415596686' post='196490']

Someone has probably used an override for that hook. Best to use a post hook rather than embedding in a distributed template.

[/quote]



Hi Tony,



so I'm assuming I should create the following file:


order_confirmation.post.tpl


under



/design/themes/basic/templates/addons/my_changes/hooks/checkout


Using the same code as shown above?

Well look who’s back. How are things down under?



Yes, that is the file and location that you’d want to use. I did my code a bit different though.


<!-- Google Code for Purchase Conversion Page --><br />
    <script type="text/javascript"><br />
{literal}<br />
    /* <![CDATA[ */<br />
    var google_conversion_id = 1234567890;<br />
    var google_conversion_language = "en_US";<br />
    var google_conversion_format = "1";<br />
    var google_conversion_color = "ffffff";<br />
    var google_conversion_label = "Purchase";<br />
    if (10.0) {<br />
        var google_conversion_value = 10.0;<br />
        var google_conversion_currency = "USD"<br />
    }<br />
    /* ]]> */<br />
{/literal}<br />
    </script><br />
    <script type="text/javascript"<br />
    src="//www.googleadservices.com/pagead/<br />
    conversion.js"><br />
    </script><br />
    <noscript><br />
    <img height="1" width="1" border="0" src="upload://ux1zSLp9vBY9KEUw7CSvZVrESee.gif"><br />
    </noscript><br />
<br />
<!-- End Google Code for Purchase/Sale Conversion Page --><br />

```<br />
<br />
Thanks,<br />
<br />
Brandon

I'm surprised this is not completely standard now with CS-Cart 4.x??

Why would it be? I don't use Adwords. Most of my clients also don't. Actually, out of all of my clients, I think only like 4 stores use Adwords.

Let me know how you get along,



We've had terrible trouble with this since upgrading

What kind of trouble. This hook has worked flawlessly since its inception. Are you getting errors in your browser console? If so, what are they? If not, maybe you could describe your problem.

Our adword campaigns don't seem to be tracked since moving to 4.1.5

so we can't see what ads are being targeted correctly,



I've just modified the code below

{* place any code you wish to display on this page right after the order has been placed *}

{hook name=“checkout:order_confirmation”}

to:





{literal}







{/literal}






Obviously XXXXXXXXXXX is the conversion code of the client,

I'll try see does this work with adwords now, ( can take 24 hours to update )



The code seems to appear on the checkout page correctly,

If you used the hook instead of putting your code in the main template then your changes would still be there after you upgraded. That's the whole point of using hooks; so your changes are preserved.

Thanks, Will move it into the hook in my changes addon, fingers crossed the new code will work, thanks,

Tried it, doesn't appear to work.



Not saying it should be turned on by default but it would be bloody useful to have as a quick addon.

Works for me and countless others… Is the problem that the hook is not showing in the page source? Or is the problem that Google is not receiving/processing it properly?

[quote name=‘tbirnseth’ timestamp=‘1416012544’ post=‘197054’]

Works for me and countless others… Is the problem that the hook is not showing in the page source? Or is the problem that Google is not receiving/processing it properly?

[/quote]



Honestly, no bloody idea. Starting to wonder where everything is going wrong.

The code doesn’t show in view source, and that’s half the problem, so placing fake orders gets old when actual works needs to be done.



Here’s my setup:



My Changes : Installed.

/design/themes/basic/templates/addons/my_changes/hooks/checkout/order_confirmation.post.tpl
```<br />
<br />
Contents:<br />
```php
<br />
<!-- Google Code for Google Adwords - Purchase Conversion Page --><br />
		{literal}  <br />
		<script type="text/javascript"><br />
				/* <![CDATA[ */<br />
				var google_conversion_id = XXXXXXXXX;<br />
				var google_conversion_language = "en";<br />
				var google_conversion_format = "3";<br />
				var google_conversion_color = "ffffff";<br />
				var google_conversion_label = "Purchase";<br />
				var google_conversion_value = {/literal}{$order_info.total}{literal};<br />
				var google_conversion_currency = "AUD";<br />
				var google_remarketing_only = false;<br />
				/* ]]> */<br />
				</script><br />
				<script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js"><br />
				</script><br />
<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 />

```<br />
<br />
If anything looks completely out of place, let me know, I'm getting old.

If you have cleared your cache after creating this order_confirmation.post.tpl file then you should in fact see your code (even if the code is wrong) in a view source of the checkout.complete page.



I do not see anything wrong with what you've posted.



Verify that the my_changes addon is “active” (it is disabled by default in V4) and verify that the cache is in fact clearing (I.e. you don't have ownership/permission problems on your site).

[color=#008800]/design/[/color][color=#000000]themes[/color][color=#666600]/[/color][color=#000000]basic[/color][color=#666600]/[/color][color=#000000]templates[/color][color=#666600]/[/color][color=#000000]addons[/color][color=#666600]/[/color][color=#000000]my_changes[/color][color=#666600]/[/color][color=#000000]hooks[/color][color=#666600]/[/color][color=#000000]checkout[/color][color=#666600]/[/color][color=#000000]order_confirmation[/color][color=#666600].[/color][color=#000000]post[/color][color=#666600].[/color][color=#000000]tpl[/color]



Does the theme directory need to be related to the theme which you're using? For example, I'm using a theme called Spark. Should I put it in the directory /design/themes/spark/…?



Thanks

Yes

Honestly, no bloody idea. Starting to wonder where everything is going wrong.
The code doesn't show in view source, and that's half the problem, so placing fake orders gets old when actual works needs to be done.

Here's my setup:

My Changes : Installed.

/design/themes/basic/templates/addons/my_changes/hooks/checkout/order_confirmation.post.tpl
Contents:
		{literal}  
		
				
			
	{/literal}
If anything looks completely out of place, let me know, I'm getting old.

although I have the 'My changes' add-on activated, I do not see it when going to /design/themes/basic/templates/addons/ I can find the find the file in \yotpo\hooks\checkout and also \google_analytics\hooks\checkout Which (if any) should the AdWords code be placed?

Can somone please advise on how to have the google conversion code to work?

I am using buyshop theme

I have been placing it using a hook under /mydomain.com/design/themes/buyshop/templates/addons/my_changes/hooks/checkout as order_confirmation.post.tpl

google team was unable to help...they said the hook is not working...

please let me know if you need more info to help

thank you

If the hook is not being called, then you will have to contact the vendor of your theme to find out why. It would be very strange for a cs-cart theme vendor NOT to support the order_confirmation.post.tpl hook since that would break a ton of things.

What is the content of your order_confirmaiton.post.tpl file:

Enabling the Google Analytics addon and entering the appropriate credentials should be all you need for conversion code. You shouldn't have to add anything yourself. Are you sure you have your credentials set properly?