Forum Moderators: open

Message Too Old, No Replies

Javascript document.write of utmlinker function of Google Analytics; a

Is there an alternative way to call the JavaScript utmlinker function of GA

         

julienraby

5:23 pm on Oct 18, 2006 (gmt 0)

10+ Year Member



Hi everyone, quick question for JavaScript masters...

The Google Analytics JavaScript function utmlinker allow to track users that spans across multiple sites. The method that they gives us to call the function is this one:

<script type="text/javascript">
document.write('<a href="javascript:__utmLinker(\' [secondsite.com');">Log...] in Now</a>');
</script>
<noscript>
<a href=" [secondsite.com">Log...] in Now</a>
</noscript>

Now, my question is: Is there a way to call the utmlinker function without having to document.write the whole <a> tag? This is not a SE friendly way, so I would really prefer to be able to do something like:

<a href=" [secondsite.com"...] onclick="_utmlinker (this)">Log in Now</a>

Altough I'm pretty sure this won't work, I can't imagine there is no alternative to this...

Help anyone?

Thanks

whoisgregg

5:36 pm on Oct 18, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You're almost there. :)

<a href="https://www.secondsite.com/" onclick="__utmLinker(this.href); return false;">Log in Now</a>

Welcome to WebmasterWorld, julienraby!