|
|
Thread Tools | Display Modes |
|
#1
|
|
|
Major grins
|
Google Analytics Filter Cookie
I've had google analytics setup for a while, and I really like the information that it gives me about visitors to my site. That being said, I would like to be able to filter out my own traffic when I access the site. I'm behind a NAT device both at home and at work (and home is DHCP on top of that) so I don't want to filter based on IP. Based on what I can find on the Google website the best way to do this filtering is to set this up set a custom cookie and have google analytics filter based on that. They recommend putting code along the lines of the following in the body tag on a single page on your site
Code:
onLoad="javascript:pageTracker._setVar('test_value');alert('Cookie Set?')"
What I can't seem to figure out is a way to put this code on just a single page of my site, in a private (unlisted) gallery for example, that I would go to for any machine/account that I wanted to have excluded from my google analytics reporting. It seems like if I were to put the code in the body tag of the customization page that it would be able to set the cookie, but it would set it for everyone that visits my site, not just me. Obviously as soon as I set the cookie I would want to pull the code back out, and hope that no one else loaded any pages while the code was there. Every time I went to another computer/account/browser I would need to put the code back in, and again hope that no one else loaded any pages while the code was there. A slightly cleaner solution would seem to be to put the code in the customization box and use the preview button to generate the cookie for myself, without the possiblity of being generated for anyone who happened to be visiting my site at the time. However this method still requires that I put the code in every time I want to generate the cookie for a new machine/logon account/browser. Any suggestions for a more elegant solution from those of you much better versed in the land of style sheets, html, and smugmug customization than me?
__________________
--Travis |
|
|
|
|
#2
|
||
|
Scripting dude-volunteer
|
Quote:
If that is the right Javascript code that would actually work for you, then what you would put in the gallery description would be this: Code:
<html>
<script>onLoad="javascript:pageTracker._setVar('test_value');alert('Cookie Set?')"</script>
</html>
__________________
--John Homepage • Popular JFriend's javascript customizations • Secrets for getting fast answers on Dgrin Always include a link to your site when posting a question |
|
|
|
||
| Tell The World! | |
| Thread Tools | |
| Display Modes | |
|
|