Excluding Own Internal Traffic from Google Analytics

BobTBobT Registered Users Posts: 44 Big grins
edited January 25, 2013 in SmugMug Support
On the Google Analytics there are some instructions on how to exclude ones own internal traffic but it is not specific to SmugMug. Has anyone tried it on SmugMug? If so how did you do it?
«1

Comments

  • ChancyRatChancyRat Registered Users Posts: 2,141 Major grins
    edited March 31, 2010
    BobT wrote:
    On the Google Analytics there are some instructions on how to exclude ones own internal traffic but it is not specific to SmugMug. Has anyone tried it on SmugMug? If so how did you do it?

    I don't know the answer but I'm interested in the information. However, what do you mean, "one's own internal traffic ... specific to SmugMug"? Who would be excluded?
  • AllenAllen Registered Users Posts: 10,013 Major grins
    edited March 31, 2010
    BobT wrote:
    On the Google Analytics there are some instructions on how to exclude ones own internal traffic but it is not specific to SmugMug. Has anyone tried it on SmugMug? If so how did you do it?
    I found it under "Filters Applied to Profile".
    Al - Just a volunteer here having fun
    My Website index | My Blog
  • BobTBobT Registered Users Posts: 44 Big grins
    edited March 31, 2010
    ChancyRat wrote:
    I don't know the answer but I'm interested in the information. However, what do you mean, "one's own internal traffic ... specific to SmugMug"? Who would be excluded?
    I mean traffic from your own home computer if say you did some editing to your home page, imported or checked your SmugMug stats.
  • BobTBobT Registered Users Posts: 44 Big grins
    edited March 31, 2010
    Allen wrote:
    I found it under "Filters Applied to Profile".
    I've been using the instruction @ http://www.google.com/support/analytics/bin/answer.py?hl=en&answer=55481. However, I'm not sure what they mean by, "Create a new page on your domain..." or where to put the code. I ended up putting the code in the "Bottom JavaScript" panel under Customize. The main GA code is in the "Custom Footer" panel as per SmugMug instructions (not sure why). I then went out of SmugMug and back in to set the cookie on my computer. Out and in again and deleted the code in the "Bottom JavaScript" panel. It seems to work but I haven't had enough traffic yet to confirm it. The danger is that the cookie may get deleted each time I do a cleanup. This is all fairly clumsy but I guess the proper way is to fork out for a static IP address and do it that way.
  • brecklundinbrecklundin Registered Users Posts: 121 Major grins
    edited March 31, 2010
    BobT wrote:
    I've been using the instruction @ http://www.google.com/support/analytics/bin/answer.py?hl=en&answer=55481. However, I'm not sure what they mean by, "Create a new page on your domain..." or where to put the code. I ended up putting the code in the "Bottom JavaScript" panel under Customize. The main GA code is in the "Custom Footer" panel as per SmugMug instructions (not sure why). I then went out of SmugMug and back in to set the cookie on my computer. Out and in again and deleted the code in the "Bottom JavaScript" panel. It seems to work but I haven't had enough traffic yet to confirm it. The danger is that the cookie may get deleted each time I do a cleanup. This is all fairly clumsy but I guess the proper way is to fork out for a static IP address and do it that way.

    I haven't looked at the GA code or the SM API much, but can't you use a conditional that uses your logged in userID to either trigger the GA code or bounce around it? That way if you have a dynamic IP you circumvent that issue.

    I guess you could also set a long term/permanent cookie or maybe tell your clean-up software to ignore the SM cookie? Of course this would also be a bit of a kludge as well, especially as it does not handle if you log-in from a "foreign" computer.
  • jfriendjfriend Registered Users Posts: 8,097 Major grins
    edited March 31, 2010
    I haven't looked at the GA code or the SM API much, but can't you use a conditional that uses your logged in userID to either trigger the GA code or bounce around it? That way if you have a dynamic IP you circumvent that issue.

    I guess you could also set a long term/permanent cookie or maybe tell your clean-up software to ignore the SM cookie? Of course this would also be a bit of a kludge as well, especially as it does not handle if you log-in from a "foreign" computer.
    This is an interesting idea - the whole thing could be solve in your page without using blocking cookies and all that. BobT, what is your site address so I can look at your GA code and see if a simple one-line conditional can be added so GA won't record anything when you're logged in.
    --John
    HomepagePopular
    JFriend's javascript customizationsSecrets for getting fast answers on Dgrin
    Always include a link to your site when posting a question
  • ChancyRatChancyRat Registered Users Posts: 2,141 Major grins
    edited April 1, 2010
    jfriend wrote:
    This is an interesting idea - the whole thing could be solve in your page without using blocking cookies and all that. BobT, what is your site address so I can look at your GA code and see if a simple one-line conditional can be added so GA won't record anything when you're logged in.

    Please let us all know if you can do that and how? Thanks.
  • jfriendjfriend Registered Users Posts: 8,097 Major grins
    edited April 1, 2010
    ChancyRat wrote:
    Please let us all know if you can do that and how? Thanks.
    Add the three lines in red to your Google Analytics code:
    [B]<[/B]script type="text/javascript"[B]>[/B]
    var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
    document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
    [B]<[/B]/script[B]>[/B]
    [B]<[/B]script type="text/javascript"[B]>[/B]
    try {
    [COLOR=red]if (!YD.hasClass(document.body, "loggedIn"))
    {[/COLOR]
    var pageTracker = _gat._getTracker("UA-8541296-2");
    pageTracker._trackPageview();
    [COLOR=red]}[/COLOR]
    } catch(err) {}[B]<[/B]/script[B]>[/B]
    

    For other people reading this post, do NOT copy this code into your page. This block of code is specific to ChancyRat's page because it has his Google Analytics tracking code in it. If you also want to make this modification to your page, then add the three lines in red to your own code in this exact location. Do NOT copy this whole block of code into your page.
    --John
    HomepagePopular
    JFriend's javascript customizationsSecrets for getting fast answers on Dgrin
    Always include a link to your site when posting a question
  • BobTBobT Registered Users Posts: 44 Big grins
    edited April 2, 2010
    jfriend wrote:
    This is an interesting idea - the whole thing could be solve in your page without using blocking cookies and all that. BobT, what is your site address so I can look at your GA code and see if a simple one-line conditional can be added so GA won't record anything when you're logged in.
    Much appreciated if you could do that. My site is www.bobtrlin.com
  • jfriendjfriend Registered Users Posts: 8,097 Major grins
    edited April 2, 2010
    BobT wrote:
    Much appreciated if you could do that. My site is www.bobtrlin.com
    Change your Google code in your custom footer to this (add the part in red):
    [B]<[/B]script type="text/javascript"[B]>[/B]
    var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
    document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
    [B]<[/B]/script[B]>[/B]
    [B]<[/B]script type="text/javascript"[B]>[/B]
    try {
    [COLOR=red]if (!YD.hasClass(document.body, "loggedIn"))
    {[/COLOR]
    var pageTracker = _gat._getTracker("UA-15371684-4");
    pageTracker._setDomainName("none");
    pageTracker._setAllowLinker(true);
    pageTracker._trackPageview();
    [COLOR=red]}[/COLOR]
    } catch(err) {}[B]<[/B]/script[B]> [/B]
    
    --John
    HomepagePopular
    JFriend's javascript customizationsSecrets for getting fast answers on Dgrin
    Always include a link to your site when posting a question
  • ChancyRatChancyRat Registered Users Posts: 2,141 Major grins
    edited April 2, 2010
    jfriend wrote:
    Add the three lines in red to your Google Analytics code:
    [B]<[/B]script type="text/javascript"[B]>[/B]
    var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
    document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
    [B]<[/B]/script[B]>[/B]
    [B]<[/B]script type="text/javascript"[B]>[/B]
    try {
    [COLOR=red]if (!YD.hasClass(document.body, "loggedIn"))
    {[/COLOR]
    var pageTracker = _gat._getTracker("UA-8541296-2");
    pageTracker._trackPageview();
    [COLOR=red]}[/COLOR]
    } catch(err) {}[B]<[/B]/script[B]>[/B]
    
    For other people reading this post, do NOT copy this code into your page. This block of code is specific to ChancyRat's page because it has his Google Analytics tracking code in it. If you also want to make this modification to your page, then add the three lines in red to your own code in this exact location. Do NOT copy this whole block of code into your page.

    John, well thank you once again. I had to get a spot of time to understand this, so before I paste this in, could you tell me what it will do exactly? It means whenever or wherever I am, if I log in as owner, I will be excluded? And so, I have the google analytics code on my site, and in Analytics, I have filtered out my IP address (but I don't think it's working, maybe I have a dynamic IP address and don't know it? I haven't figured that out.) Anyway, so with filters in place, it's okay to also paste in this code?

    And, I also have excluded the ip address of my assistant, who logs in on her password but my account name. Can this code block her whenever she's logged in also?

    www.joinrats.com
  • jfriendjfriend Registered Users Posts: 8,097 Major grins
    edited April 2, 2010
    ChancyRat wrote:
    John, well thank you once again. I had to get a spot of time to understand this, so before I paste this in, could you tell me what it will do exactly? It means whenever or wherever I am, if I log in as owner, I will be excluded? And so, I have the google analytics code on my site, and in Analytics, I have filtered out my IP address (but I don't think it's working, maybe I have a dynamic IP address and don't know it? I haven't figured that out.) Anyway, so with filters in place, it's okay to also paste in this code?

    And, I also have excluded the ip address of my assistant, who logs in on her password but my account name. Can this code block her whenever she's logged in also?

    www.joinrats.com
    Yes, the code checks to see if you are not logged in and only in that case does it allow the call to track the page. If you are logged in, it skips the call that actually tracks the page.
    --John
    HomepagePopular
    JFriend's javascript customizationsSecrets for getting fast answers on Dgrin
    Always include a link to your site when posting a question
  • ChancyRatChancyRat Registered Users Posts: 2,141 Major grins
    edited April 3, 2010
    jfriend wrote:
    Yes, the code checks to see if you are not logged in and only in that case does it allow the call to track the page. If you are logged in, it skips the call that actually tracks the page.

    What if I'm logged in, and then a visitor somewhere lands on the site while I'm logged in? Are the visitor's views counted?
  • jfriendjfriend Registered Users Posts: 8,097 Major grins
    edited April 3, 2010
    ChancyRat wrote:
    What if I'm logged in, and then a visitor somewhere lands on the site while I'm logged in? Are the visitor's views counted?
    Only your local browser is logged in. The "logged in" property is in a cookie in your own browser. No visitor's browser will have that cookie so their hits will be recorded.

    Thus, visitor's hits will always be recorded unless they sit down and use your browser while it's logged in.
    --John
    HomepagePopular
    JFriend's javascript customizationsSecrets for getting fast answers on Dgrin
    Always include a link to your site when posting a question
  • ChancyRatChancyRat Registered Users Posts: 2,141 Major grins
    edited April 3, 2010
    jfriend wrote:
    Only your local browser is logged in. The "logged in" property is in a cookie in your own browser. No visitor's browser will have that cookie so their hits will be recorded.

    Thus, visitor's hits will always be recorded unless they sit down and use your browser while it's logged in.

    Will my assistant's views be counted? She uses my login name but not the same password?
  • jfriendjfriend Registered Users Posts: 8,097 Major grins
    edited April 3, 2010
    ChancyRat wrote:
    Will my assistant's views be counted? She uses my login name but not the same password?
    It appears to me that an assistant login will look like a normal login so their views will not be counted either if they are logged in as an assistant.
    --John
    HomepagePopular
    JFriend's javascript customizationsSecrets for getting fast answers on Dgrin
    Always include a link to your site when posting a question
  • RogersDARogersDA Registered Users Posts: 3,502 Major grins
    edited April 4, 2010
    Could you do this to exclude visits from a specific IP (external IP from the modem - not the internal IP)?
  • jfriendjfriend Registered Users Posts: 8,097 Major grins
    edited April 4, 2010
    RogersDA wrote:
    Could you do this to exclude visits from a specific IP (external IP from the modem - not the internal IP)?
    I believe GA has features built into it that let you exclude some IP addresses. This technique does not do that.
    --John
    HomepagePopular
    JFriend's javascript customizationsSecrets for getting fast answers on Dgrin
    Always include a link to your site when posting a question
  • mcgilmcgil Registered Users Posts: 110 Major grins
    edited April 4, 2010
    For the ones looking to block your own traffic (logged in or not), you can use the IP filtering on google analytics. Follow these steps:

    - find your external IP via http://whatismyip.org
    - go to your Google Analytics account, go into Filter Manager
    - Add a new filter
    * choose exclude from the IP addresses
    * don't forget to select your website profile via add below

    et voilà ! :)
  • BobTBobT Registered Users Posts: 44 Big grins
    edited April 6, 2010
    jfriend wrote:
    Change your Google code in your custom footer to this (add the part in red):
    [B]<[/B]script type="text/javascript"[B]>[/B]
    var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
    document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
    [B]<[/B]/script[B]>[/B]
    [B]<[/B]script type="text/javascript"[B]>[/B]
    try {
    [COLOR=red]if (!YD.hasClass(document.body, "loggedIn"))
    {[/COLOR]
    var pageTracker = _gat._getTracker("UA-15371684-4");
    pageTracker._setDomainName("none");
    pageTracker._setAllowLinker(true);
    pageTracker._trackPageview();
    [COLOR=red]}[/COLOR]
    } catch(err) {}[B]<[/B]/script[B]> [/B]
    
    John
    I've made the changes and it seems to be working well although the cookie method I put in before is probably still active. I expect that this will exclude anyone else that is logged into SmugMug and gets to my site from there. That's OK because GA was excluding them by default anyway. I suggest you post you method on the GA forum.<img src="https://us.v-cdn.net/6029383/emoji/thumb.gif&quot; border="0" alt="" >
  • jfriendjfriend Registered Users Posts: 8,097 Major grins
    edited April 6, 2010
    BobT wrote:
    John
    I've made the changes and it seems to be working well although the cookie method I put in before is probably still active. I expect that this will exclude anyone else that is logged into SmugMug and gets to my site from there. That's OK because GA was excluding them by default anyway. I suggest you post you method on the GA forum.thumb.gif
    It will only exclude someone logged into your site, not someone logged into their own Smugmug site, but visiting yours. Where's the GA forum?
    --John
    HomepagePopular
    JFriend's javascript customizationsSecrets for getting fast answers on Dgrin
    Always include a link to your site when posting a question
  • brecklundinbrecklundin Registered Users Posts: 121 Major grins
    edited April 8, 2010
    jfriend wrote:
    It will only exclude someone logged into your site, not someone logged into their own Smugmug site, but visiting yours. Where's the GA forum?

    John,

    clap.gif Nice to see it was indeed a simple one-liner conditional. ;) Thanks for taking the time to look into it. Right now I'm re-evaluating SM (they are on that, ahem, "s-list" and likely will be for a while, if not permenantly... rolleyes1.gif ) as a service to integrate into a desktop (along with it's browse & server based analogs) app I've written, but that is a whole different discussion, still, I really was not up for sleuthing it out...plus, you are "da man"...hehehe... :D
  • ChancyRatChancyRat Registered Users Posts: 2,141 Major grins
    edited April 8, 2010
    jfriend wrote:
    Yes, the code checks to see if you are not logged in and only in that case does it allow the call to track the page. If you are logged in, it skips the call that actually tracks the page.

    My first test results are in, and unfortunately my page views got counted. I know this because (1) there was only one [return] visitor from my city, (2) hits were recorded for some test pages I set up, which were set to private, including tracking when I put the gallery in one category and then moved it to another, and (3) Hits were recorded on the other pages I visited, which together paint the exact picture of (only) my travel route through the site.

    The only thing I can think of is that perhaps there are cookies somewhere that haven't been cleared? I will check that option out and re-clear, though I clear on a regular basis.
  • jfriendjfriend Registered Users Posts: 8,097 Major grins
    edited April 8, 2010
    ChancyRat wrote:
    My first test results are in, and unfortunately my page views got counted. I know this because (1) there was only one [return] visitor from my city, (2) hits were recorded for some test pages I set up, which were set to private, including tracking when I put the gallery in one category and then moved it to another, and (3) Hits were recorded on the other pages I visited, which together paint the exact picture of (only) my travel route through the site.

    The only thing I can think of is that perhaps there are cookies somewhere that haven't been cleared? I will check that option out and re-clear, though I clear on a regular basis.
    Were you logged in to Smugmug on your custom domain when you did those page views? This is only supposed to block hit recording when you are logged in to Smugmug for the site that you're visiting.
    --John
    HomepagePopular
    JFriend's javascript customizationsSecrets for getting fast answers on Dgrin
    Always include a link to your site when posting a question
  • ChancyRatChancyRat Registered Users Posts: 2,141 Major grins
    edited April 8, 2010
    jfriend wrote:
    Were you logged in to Smugmug on your custom domain when you did those page views? This is only supposed to block hit recording when you are logged in to Smugmug for the site that you're visiting.

    Hah! Yes, logged in via my custom domain.
    So when you say
    This is only supposed to block hit recording when you are logged in to Smugmug for the site that you're visiting.

    you mean I should log in to: www.joinrats.smugmug.com

    Sorry, I misunderstood that part.
    Now the puzzle is why GA 'got me' in the first place because I have my IP address removed. eek7.gif
  • jfriendjfriend Registered Users Posts: 8,097 Major grins
    edited April 8, 2010
    ChancyRat wrote:
    Hah! Yes, logged in via my custom domain.
    So when you say


    you mean I should log in to: www.joinrats.smugmug.com

    Sorry, I misunderstood that part.
    Now the puzzle is why GA 'got me' in the first place because I have my IP address removed. eek7.gif
    You just need to be logged in. If you can see the Tools button, it's not supposed to record your hits. If you don't see the Tools button because Smugmug doesn't think you're logged in, then it should record your hits.
    --John
    HomepagePopular
    JFriend's javascript customizationsSecrets for getting fast answers on Dgrin
    Always include a link to your site when posting a question
  • borgborg Registered Users Posts: 13 Big grins
    edited February 7, 2011
    jfriend wrote: »
    Change your Google code in your custom footer to this (add the part in red):
    [B]<[/B]script type="text/javascript"[B]>[/B]
    var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
    document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
    [B]<[/B]/script[B]>[/B]
    [B]<[/B]script type="text/javascript"[B]>[/B]
    try {
    [COLOR=red]if (!YD.hasClass(document.body, "loggedIn"))
    {[/COLOR]
    var pageTracker = _gat._getTracker("UA-15371684-4");
    pageTracker._setDomainName("none");
    pageTracker._setAllowLinker(true);
    pageTracker._trackPageview();
    [COLOR=red]}[/COLOR]
    } catch(err) {}[B]<[/B]/script[B]> [/B]
    

    Ok! Help please!

    I also copied whole this into my "Custom footer" in "Advanced site wide customization"... Also I changed UA code into mine.

    Please tell me is it OK!!?

    Thanks!
  • jfriendjfriend Registered Users Posts: 8,097 Major grins
    edited February 7, 2011
    borg wrote: »
    Ok! Help please!

    I also copied whole this into my "Custom footer" in "Advanced site wide customization"... Also I changed UA code into mine.

    Please tell me is it OK!!?

    Thanks!
    Kind of hard for us to help when you don't include a link to your site.
    --John
    HomepagePopular
    JFriend's javascript customizationsSecrets for getting fast answers on Dgrin
    Always include a link to your site when posting a question
  • borgborg Registered Users Posts: 13 Big grins
    edited February 7, 2011
    jfriend wrote: »
    Kind of hard for us to help when you don't include a link to your site.

    Veery sorry! Here it is:

    http://botastockimages.smugmug.com/
  • borgborg Registered Users Posts: 13 Big grins
    edited February 7, 2011
Sign In or Register to comment.