How to exclude traffic in Google Analytics from Dynamic IP addresses?

后端 未结 9 526
执笔经年
执笔经年 2021-02-05 21:04

Google\'s detection of Unusual traffic is nice. But how is it handling Dynamic IP addresses?

For example,I do not have ranges of IPs and my ISP provides Dynamic IP which

相关标签:
9条回答
  • 2021-02-05 21:47

    Give the Ghostery browser extension a try:
    https://www.ghostery.com/

    It's easy to define which scripts you want to block per domain. As a bonus, the extension shows which tracking scripts are loaded while you browse the web.

    0 讨论(0)
  • 2021-02-05 21:48

    We had the task to exclude a whole company from Analytics. The internet router got IP renewed circa once a day. Turned out that this router like nearly all common routers nowadays offered some options to enable dynamic IP services. Like noip.com for example.

    • You register at noip.com and choose some static domain name of your choice.
    • Then select that service (noip.com) in your router's dynamic IP options section.
    • Enter your credentials from noip.com.

    And what happens now is, that the router everyday automatically pushes its new IP to noip.com, where it gets associated to the domain name you registered before. Now on your page you can dynamically check that domain's IP and if it matches the client's (browser's) IP you exclude the Analytics scripts from being printed to the page.

    In my case I was on PHP and something along the lines of the following snippet worked out fine. See gethostbyname().

    $print_tracking_scripts = TRUE;
    
    if (gethostbyname('my-unique-name.ddns.net') === $_SERVER['REMOTE_ADDR']) {
      $print_tracking_scripts = FALSE;
    }
    
    if ($print_tracking_scripts) {
      // Print or include tracking scripts however you like.
    }
    
    0 讨论(0)
  • 2021-02-05 21:49

    Why not simple add a filter:

    1. Go to Admin
    2. Select View Profile and create a new view
    3. Click on Filter
    4. Add New Filter
    5. Name it IP Exclusion or whatever
    6. Select the Custom Filter Radio Button
    7. Check Exclude
    8. Select IP Address as Filter Field
    9. In Filter pattern Use Regex to define the range of IP address

    For example for IP ranging from 182.73.42.140 to 182.73.42.150 The regex would be:

    ^182.73.42.(1(4[6-9]|50))$

    Here's a screenshot for same

    If you have trouble understanding RegEx, you may use this tool to create IP range regex

    0 讨论(0)
提交回复
热议问题