Created
August 15, 2013 21:41
-
-
Save underdown/6245230 to your computer and use it in GitHub Desktop.
cross domain link tracking - Google Analytics
(cribbed from http://moz.com/ugc/google-analytics-cross-domain-tracking-made-easy-14596)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script type="text/javascript"> | |
| //<![CDATA[ | |
| $(document).ready(function() { | |
| // Add onClick _link to all <a> elements on page where href contains example-A.com | |
| $("a[href*='example-A.com']").click(function() { | |
| _gaq.push(['_link', this.href]); | |
| return false; | |
| }); | |
| // Add onSubmit _linkByPost to all <form> elements on page where action contains example-A.com | |
| $("form[action*='example-A.com']").attr("onSubmit","_gaq.push(['_linkByPost', this])"); | |
| }); | |
| //]]> | |
| </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment