简体   繁体   中英

Universal Analytics Tracking is Preventing Anchor Link From Working

I'm working on an email, and the writer wants the link to go directly to a video on a page. This video is in a tab, and lower on the page.

I set up an anchor to go to the video, but once Universal Analytics tracking has been added to the URL, the anchor link no longer works.

Works:

<a href="http://www.foo.com/page-name/?tabset0=1#anchor-name">Link Text</a>

Loads Page Without Going to Anchor:

<a href="http://www.foo.com/page-name/?tabset0=1#anchor-name&utm_source=foo-source&utm_medium=foo-medium&utm_content=foo-content&utm_campaign=foo-campaign">Link Text</a>

Is there anything I can do to get the anchor link to work properly?

I think the URL is a bit malformed in the second example (it may work but it's not what you mean to be accessing necessarily)

Try using:

http://www.foo.com/page-name/?tabset0=1&utm_source=foo-source&utm_medium=foo-medium&utm_content=foo-content&utm_campaign=foo-campaign#anchor-name

Fragment identifiers / anchor (as you refer to it) are supposed to be given at the end (the very end) of the address-- if you put it in the middle of the query it won't be passed correctly. In fact, fragment identifiers aren't given to the server. Only the client gets those... the CGI query is definitely given to the server.

Here's some more info: https://en.wikipedia.org/wiki/Fragment_identifier

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM