Hi there,

I have been trying to add Google tracking codes to my website and there is a problem with the way Xara handles the sequence of <script> tags:

Google needs a global tag on every page, such as -

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-43XXX2NPLR"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-43Q1XXXPLR'); // Analytics
gtag('config', 'AW-1072XXX328'); // Adwords
</script>

That can be added into the Xara website either via the 'Web Analytics' tab or 'Website HTML Code (Head)'.
All good so far. But for tracking action conversions i.e. where a customer then goes to a particular page, Google needs another tag on the particular landing page as well e.g.

<!-- Event snippet for StartedKeySense conversion page -->
<script>
gtag('event', 'conversion', {'send_to': 'AW-1072XXX328/5G85CNTK-usCEICJuP8D'});
</script>

which must be immediately following the global tag.

The problem is that the only way I can add the conversion tag is using 'Page HTML (Head)'. But when Xara uploads the website it puts this tag way, way down the sequence of code - nowhere near the global tag script. I cannot see any way to force it directly following the global tag. The end result is that Google doesn't recognise the tag (at all).

The temporary 'fix' I have in place is to manually edit the pages after I publish (i.e. change the HTML source), then to remember to do it again every time there is an update.

Surely there must be a better way.
Any ideas anyone?