There\'s a site that uses on page buttons and hashtags (#) in their urls to manipulate how their content (links) is ordered. They link to my site and I\'d like to know what
The hash portion of URLs is never sent to the server, and it appears it is not stored in the javascript object for the document.referrer.
The only way to access the hash portion of a URL is to access it from within the page when the browser is on that page.
Translation: There's no way to get it unless you control the referring page, and you pass along the hash fragment in the link.
more info: http://www.razzed.com/2009/02/12/uh-oh-ajax-powered-search-kills-keywords-in-referrers/
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXX-X']);
/*
* Function: Hash Custom Variable
* Pass everything after # in document.referrer to GA custom variable
*/
(function() {
// Parse out the hash part of the referrer
var referrerHash = document.referrer.split("#")[1];
// If the hash exists, pass it back to GA
if(typeof referrerHash !== "undefined") {
_gaq.push(['_setCustomVar', 1, 'Sort', referrerHash, 3]);
}
})(); // IIFE to not leak global vars
// Have to _trackPageview after custom variable is pushed
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script');
ga.type = 'text/javascript';
ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ga, s);
})();
</script>
Helpful Sources: