Hi,
When you are in between the <?php and the ?> tags, you are inside PHP code. You can only write PHP code in there.
The last ?> of a file can be omitted (which is usually the case).
Knowing all this, in the checkout / end view file, you want to either add your javascript code before the <?php tag already there, or you want to add a ?> tag at the end, and then add your javascript code.
Note also that we already provide a plugin for Google Analytics, which reports the ecommerce data, including sales to Google:
www.hikashop.com/marketplace/product/108...egration-google.html
You can then configure your Ads account to import the GA purchase events reported by the plugin:
support.google.com/analytics/answer/1063...11877394143257898-EU