Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Arnim Anhut 137 posts 148 karma points
    Jul 24, 2009 @ 19:21
    Arnim Anhut
    0

    Disable Google-Analytics on local access

    Hello,

    I'm using Google-Analytics on my pages. Quite cool tool. But one thing is buging me: Because I don't wanna log my own access, how can I disable the analytics-script when I'm calling pages from within my own network?

    One idea was to call the website using an different url preffix like "intern.mywebpage.de" instead of "www.mywebpage.de". Now I could write an XSLT that checks the address and inserts the script only on calls for "www...". But this looks like a quite big overhead on each page-call.

    Is there a better way? Happy for any idea,

    Arnim.

  • Heather Floyd 610 posts 1032 karma points MVP 6x c-trib
    Jul 24, 2009 @ 20:15
    Heather Floyd
    2

    @Arnim - I think the easiest thing to do is to use the Google Analytics exclusion cookie - just create a simple content page in your site with the cookie-setting-code, publish it, visit it (which sets the cookie for you) then just unpublish or delete the content page. Keep in mind that if you use software to clean out your cookies, you should set it to exclude this special cookie.

    For the Google Analytics exclude cookie code and other info, see this: http://www.google.com/support/analytics/bin/answer.py?hl=en&answer=55481

    ~Heather

  • Morten Bock 1867 posts 2140 karma points MVP 2x admin c-trib
    Jul 24, 2009 @ 20:37
    Morten Bock
    0

    I don't think a single simple macro like that would hurt you performance too bad.

    Another way to go could be doing some inline scripting in your masterpage template, if you're using V4? 

  • Kyle Skrinak 272 posts 327 karma points
    Jul 24, 2009 @ 20:55
    Kyle Skrinak
    0

    Or add to your /etc/hosts file:

    # 127.0.0.1  ssl.google-analytics.com #[disabled = Firefox issues] 

    127.0.0.1  www.google-analytics.com #[Google Analytics] 

    127.0.0.1  4.afs.googleadservices.com 

    127.0.0.1  feedads.googleadservices.com 

    127.0.0.1  imageads.googleadservices.com

    from the marvelous "MVP Hosts" file -- which adds a whole lot of other benefits: http://www.mvps.org/winhelp2002/hosts.htm

    That will keep g-a from getting your information.

  • Petr Snobelt 923 posts 1535 karma points
    Jul 24, 2009 @ 21:32
    Petr Snobelt
    0

    @Kyle: This way whole analytics are disabled, isn't it? Analytics backend and other sites statistics too.

  • Kyle Skrinak 272 posts 327 karma points
    Jul 25, 2009 @ 01:27
    Kyle Skrinak
    0

    @Petr: you don't turn G-A off, just the statistics reporting from the machine with the /etc/hosts entry. That might be the only rub; Arnim will have to do this to every machine inside his network. BUT -- no need to modify code -- it's what we do, and the helps diminish pushing data out from our network.

  • Petr Snobelt 923 posts 1535 karma points
    Jul 25, 2009 @ 07:50
    Petr Snobelt
    0

    @Kyle: Yes, but it disable reporting for everysite, not only for his own site.

    @Arnim: You can also check headerhost in javascript and choose if start ga tracking. But as Morten wrote this simple macro dosn't hurt performance.

  • Tom 50 posts 100 karma points
    Jul 25, 2009 @ 08:38
    Tom
    3

    Use the Google Analytics dashboard and disable your own ip for your site, step by step info from http://www.ophircohen.com/2008/04/24/google-analytics-filters-advanced-adwords-filter/:

    1. Login to your Google Analytics Account
    2. Select the profile you want to work on and click “edit”
    3. Go to the third gray box named “Filters Applied to Profile”
    4. Click “Add Filter” on the top right
    5. Select “Add new Filter for Profile” with the radio button
    6. Give the Google Analytics filter a name (example: “exclude my own visits”
    7. Select “Exclude traffic from an IP address”
    8. Type in your IP address with a regular expression syntax, so you have to replace “.” with “\.”
    So if your IP address is: 123.456.789.012 then you need to type in: 123\.456\.789\.012
    You can also use match types and wild cards.
    9. Click “finish” and you’re done!

    Google Analytics Filter - Exclude IP

    What happens now?
    Well - now all the NEW data Google Analytics collects will exclude your IP’s. Make no mistakes - if your IP has visited the web site in the past, it will still show, as Google Analytics Filters only affect the future.

  • Arnim Anhut 137 posts 148 karma points
    Jul 25, 2009 @ 12:18
    Arnim Anhut
    0

    Whew, Umbraco-Community proves again - thanx for all your anwers!

    At the moment I'm using a small XSLT inside the MasterTemplate, guess it works fine. This solution also works perfect when I'm testing from at home or on the road. At least if I remember to use the correct subdomain everytime.

    <xsl:param name="currentPage"/>
    <xsl:variable name="url" select="substring-before(umbraco.library:RequestServerVariables('HTTP_HOST'),'.')" /> <xsl:template match="/">
      <xsl:if test="$url!='intern'">
    <script type="text/javascript">
    ....google script in here...
    </script>
      </xsl:if>
    </xsl:template>

    Filter settings as shown by Tom seem also an quite perfect way as long as I'm testing from inside my local intranet.

    @Tom: One Question, maybe you can help me out - which IP do I have to filter? My local Intranet-IP i.e. 192\.168\.* or my extern Internet-IP?

    @Morten: I'm using (of course) V4, can you show me how inline-coding would look like?

    Thanx again to all, quite interessing, to see what different aproaches are possible!

    Greets, Arnim.

  • Tom 50 posts 100 karma points
    Jul 25, 2009 @ 13:11
    Tom
    0

    @Arnim Anhut: You should add your extern internet ip.

  • Morten Bock 1867 posts 2140 karma points MVP 2x admin c-trib
    Jul 25, 2009 @ 13:12
    Morten Bock
    0

    Arnim, I created some login features just by writing to templates. I use both server controls and create some methods.

    http://www.mortenbock.dk/setting-up-membership-in-umbraco-116.htm

    I think you can create a page_load method or something in there...

  • Morten Bock 1867 posts 2140 karma points MVP 2x admin c-trib
    Jul 25, 2009 @ 13:17
    Morten Bock
    0

    Something like:

    <script language="C#" runat="server">
    void Page_Load(object sender, EventArgs e){
    Response.Write("1");
    }
    </script>
Please Sign in or register to post replies

Write your reply to:

Draft