javascript - Track Subdirectory Redirect link To PDF -
i have dotnetnuke website (hosted on iis server), , of urls long. have pdfs posted of our products, , set shortcut urls convenience redirect using meta refresh redirect. read these links not added google's index , can considered "spammy". also, these redirects preventing google analytics tracking these page views.
an example shortcut url have set is: mysite.com/awesomesauce
this redirect pdf brochure of product: mysite.com/products/sauces/awesome_sauce.pdf
i add google analytics tracking track when people access or click on shortcut url link (mysite.com/awesomesauce). there way track access shortcut link avoids "spammy" meta refresh method?
i considered putting javascript @ bottom of page:
<script> // google analytics tracking code, etc. var _gaq = _gaq || []; _gaq.push(['_setaccount', 'ua-xxxxxxxx-x']); _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); })(); // redirect code (after tracking events fire) window.location = "http://mysite.com/products/sauces/awesome_sauce.pdf"; </script>
Comments
Post a Comment