Set Canonical URL via Javascript on all Marketo LPs
Hello, what we are trying is to add the canonical tag on our Marketo landing pages.
First, I used this:
<link rel="canonical" href="{{my.Page Canonical URL}}"/>
Then I created the actual token in my program and I put the link inside. Then I pasted the above code in my LP Custom Head HTML and it worked.
As we are creating a lot of pages, someone could possibly forget to update the URL within the token, so can we add the above line with JS dynamically? I tried to use this script https://gist.github.com/krschmidt/9d46d1d080454b55f8cf , but the <link> doesn't show up in the source code and also people are not 100% sure if Google will count this.
My hope is to have such script and add it to our landing page template. This way it should work automatically, without tokens or interference from our side.
Thanks,
Yavor