- Posts: 11
- Thank you received: 0
Error Embedding Google Ads Tag
2 years 5 months ago - 2 years 5 months ago #360939
by pqas
Error Embedding Google Ads Tag was created by pqas
I'm trying to embed a google ad script tag in the frontend checkout view 'end' but keep getting "syntax error, unexpected token "<", expecting end of file". I tried placing it after the "defined('_JEXEC') or die('Restricted access');" code block, no luck. Same thing when I place it after "echo JText::_('THANK_YOU_FOR_PURCHASE');" and after the last line of code "$this->nextButton = false;"
It seems like Php is not expecting the js script to be embedded which has me baffled with my limited PHP knowledge. Any ideas
It seems like Php is not expecting the js script to be embedded which has me baffled with my limited PHP knowledge. Any ideas
Last edit: 2 years 5 months ago by pqas.
Please Log in or Create an account to join the conversation.
2 years 5 months ago #360941
by nicolas
Replied by nicolas on topic Error Embedding Google Ads Tag
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
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
The following user(s) said Thank You: pqas
Please Log in or Create an account to join the conversation.
2 years 5 months ago - 2 years 5 months ago #360954
by pqas
Replied by pqas on topic Error Embedding Google Ads Tag
Very helpful
Last edit: 2 years 5 months ago by pqas.
Please Log in or Create an account to join the conversation.
Time to create page: 0.119 seconds