Where Do You Put Adwords Conversion Code

I have added the Adwords conversion code in a block on my checkout page but if somebody does not complete the checkout then I don't get a real conversion (ie a sale) but Adwords records it as conversion.

I could put the code on the thankyou page but many of my customers pay with Paypal and never return to see the thankyou page so I would miss this being recorded as a conversion.

Has anybody a solution to this?



There are about a 1000 posts on this topic already. Use the order:confirmation hook.

Well that's my problem. I have searched the forum and while I didn't find 1000's I found many with conflicting advice or related to older versions. The Knowledge Base is not updated for 4.1.5

I have never created a hook before so its a bit of a mystery. I am using version 4.1.5

Do I do the following:

Create this directory


(I have looked and the my_changes directory does not exist even though the my_changes add on is active. - Is this expected ?)

Create this file with my adwords sales tracking code


So then this code will run as soon as somebody clicks the Place Order button but before the payment is processed.

Sorry if this is a basic question, just trying to learn.



Hello Paul,

You should create the design/themes/[YOUR_STOREFRONT_THEME]/templates/addons/my_changes/hooks/checkout directory. It is fine if the my_changes directory does not exist, the add-on does not create it by default.

All the rest is correct. I hope this will help you.

Be sure to either wrap any javascript you're getting from outside in {literal} tags or replace '{' with {ldelim} and '}' with {rdelim} or you will generate smarty errors. The method has not changed since V2 but in V3 the name of the hook was changed. It's been stable since then (that's about 3 years).