I've been searching through the Google Analytics documentation, but I still don't understand how I should track page views for a single "page" site that uses ajax to reveal different views. I use shebang URLs and _escaped_fragment_ to help search engines understand the site layout, but our analytics guy told me to strip out the #!
part of the URL when tracking, so when you visit mysite/#!/fish/bonker
we would run:
_gaq.push(["_trackPageview", "/fish/bonker"]);
but that seems wrong to me. Wouldn't we want our tracked URLs to align with what Google actually spiders? Is there anything wrong with tracking _gaq.push(["_trackPageview", "#!/fish/bonker"]);
?
I've been searching through the Google Analytics documentation, but I still don't understand how I should track page views for a single "page" site that uses ajax to reveal different views. I use shebang URLs and _escaped_fragment_ to help search engines understand the site layout, but our analytics guy told me to strip out the #!
part of the URL when tracking, so when you visit mysite./#!/fish/bonker
we would run:
_gaq.push(["_trackPageview", "/fish/bonker"]);
but that seems wrong to me. Wouldn't we want our tracked URLs to align with what Google actually spiders? Is there anything wrong with tracking _gaq.push(["_trackPageview", "#!/fish/bonker"]);
?
1 Answer
Reset to default 7It's important to recognize that there is a wall between Google Analytics and Google Search. There's no reason you would be penalized by having your URLs in one not correspond to what the other sees.
escaped_fragment
is purely a semi-standard for crawlers seeking to crawl AJAX content.
By default, Google Analytics does the equivalent when you don't pass a custom pageview value:
_gaq.push(["_trackPageview", location.pathname+location.search]);
If you want to have it also track the anchor
value, you can simply pass it on your own:
_gaq.push(["_trackPageview", location.pathname+location.search+location.hash]);
The benefit here is that the URLs will correspond with "real" URLs.
Long story short: You're perfectly fine doing your proposed method; I would prefer the latter (explicitly passing the actual location.hash
, not a hacked version of it), but both work.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745187687a4615714.html
评论列表(0条)