Add google code to complete.tpl; use a hook?

I want to add some google code to the order completion page.


If I add the google code to the complete.tpl page, it works and shows up on page. But I'd rather not modify this file.

From what I read on the forums, it sounds like I should use the hook in that file:

{hook name=“checkout:order_confirmation”}


Here's what I have so far:


Inside I added the google code like this:

{literal}google code here{/literal}

But the google code does not show up on order completion page. I assume my file stucture and naming is incorrect.

Any ideas?


OK. I figured this out.

my hook path was incorrect. Once I fixed the path, my google code gets inserted into the hook area in confirmation.tpl file


What I didn't understand was the hook naming and hook directory structure (very poor documentation on this).

For example, for this hook: {hook name=“checkout:order_confirmation”}


In /skins/basic/customer/addons/my_changes/hooks/

You create a directory for the first part of hook name; eg, checkout

And you create a file for the second part of the hook: eg, order_confirmation.

Note: In order for this to work, you have to to install / turn on the mychanges addon and create the directory structure listed above; eg, /skins/basic/customer/addons/my_changes/hooks/

Yes thanks a lot for your question and answer. Helped me in 2020 as well.

Also if you still don't see your changes try to clear the cache by deleting the var > cache folder.

Get product info varuiables in complete.tpl ... Google Analytics addon sales tracking and Currencies ... Looks like I have fixed it for 6.2.2 in modules/addons/affcoupons/hooks.php add use WHMCS\Cookie; and change