• Gear
  • Shots
  • Photo Craft
  • Video
  • Wide Angle
  • Support
  • New Stuff
  • More
Support SmugMug Customization Google Analytics Filter Cookie

FAQtoid

Ever wanted to create an Avatar? Creating an Avatar!

Searching Dgrin with Google Searching with Google

Dgrin Challenges

Congratulations to the Winner of DSS #128 (Sunrise or Sunset), ShootingStar.

The next Dgrin Challenge DSS #129 (Silhouette Revisited ) is open for entries through May 27th, 2013 at 8:00pm PDT.

As always, we look forward to your participation but please do take a moment to read through the rules before posting your entry.

Past DSS Challenge Winners, DSS Challenge Rules, and other important DSS Challenge information is here.

Need some help with Accessories?

Tutorials

Ever find yourself wondering just how someone managed to create an image using different effects?

Here are three simple tutorials we hope will encourage you to try something new.

The Hot Seat

A lifelong interest in landscape photography has led Eyal Oren to make a study of his adopted hometown of Marblehead, MA. As you can see, his dedication is paying off!

Africa!

Dgrinners Harryb, Pathfinder, and others joined Andy Williams and Marc Muench on Safari in East Africa recently. Here are some awesome threads to check out!

 
Thread Tools Display Modes
Old Sep-05-2008, 05:12 PM
#1
Foochar is offline Foochar OP
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?')"
and then you visit that page from any machine that you want to filter out. You then do some work on the google analytics side that seems fairly trivial and they it will filter future visits from any machine/account/browser with the cookie set from your reports.

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
Old Sep-05-2008, 05:18 PM
#2
jfriend is online now jfriend
Scripting dude-volunteer
Quote:
Originally Posted by Foochar
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?')"
and then you visit that page from any machine that you want to filter out. You then do some work on the google analytics side that seems fairly trivial and they it will filter future visits from any machine/account/browser with the cookie set from your reports.

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?
There are many ways to solve this. The easiest way to put this code in only one page on your site is to put it in the description for an unlisted gallery and then you can visit that unlisted gallery at any time from any computer.

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
HomepagePopular
JFriend's javascript customizationsSecrets for getting fast answers on Dgrin
Always include a link to your site when posting a question
Tell The World!  

Thread Tools
Display Modes

Posting Rules  
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump