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

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

/skins/basic/customer/views/checkout/complete.tpl



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

{/hook}



Here's what I have so far:

/skins/basic/customer/addons/my_changes/hooks/checkout/complete/order_confirmation.post.tpl

Inside order_confirmation.post.tpl 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?



Thanks

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



/skins/basic/customer/addons/my_changes/hooks/checkout/order_confirmation.post.tpl



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

{/hook}



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