Google Analytics: _linkbypost() on non-form cross domain links?
I'm just curious is it possible (or advisable) to use _linkbypost()
instead of just _link() on cross domain links with Google Analytics to
avoid the problems I'm having with the long query strings that _link()
produces.
_link() uses _GET to pass data by attaching a huge gibberish query string
to the destination url which causes me a few headaches: It prevents my
caching scheme (which keys off exact matching urls), drives many of my
social media widgets crazy (which have proven super important to my
business), and just looks scary and ugly which I've found really does
affect how much many users trust your site.
So I'm hoping I can get the same ability to track without losing my clean
orderly cacheable urls by passing that data via post instead of get. But
since I don't really understand how post works I don't know if this if
feasible, or if it is just a really bad idea for some other reason.
I know _linkbypost() needs a form object to function, so my plan was to
add an onSubmit function to each cross-domain link like so:
var crossLink = $(this).attr("href");
var formHTML = '<form id="crossForm" action="'+crossLink+'"
method="post"></form>';
$('body').append(formHTML);
var crossForm = $('#crossForm');
_gaq.push(['_linkByPost', crossForm]);
return false;
Assuming it's not a bad idea to begin with, does that implementation seem
reasonable?
No comments:
Post a Comment