1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Google Analytics API + .htaccess - A few lines of code

Discussion in 'Hire a Freelancer' started by Adam.Dev, May 13, 2013.

  1. Adam.Dev

    Adam.Dev Newbie

    Joined:
    May 11, 2013
    Messages:
    4
    Likes Received:
    0
    Hi All!

    So, on one of my sites, for tax reasons, I keep access to the UK blocked. Not wanting to use the clunky method of blocking an IP range - I signed up for cloudflare and used my .htaccess to pull the location from that and block GB visitors...

    SetEnvIf CF-IPCountry GB BuzzOff=1
    Order allow,deny
    Allow from all
    Deny from env=BuzzOff

    The problem is, I've just had an awesome new script installed but the way it sends/receives data isn't compatible with cloudflare. So I have to stop using it.

    I know it's possible to fetch a users location from google analytics, I just don't know how to do it.

    I don't want standard geoip stuff - too messy.

    If you can use the google api to retrieve the country of each visitor as they hit the site, and provide either a .htaccess solution like the one above, or a light php or jquery solution to block UK visitors then drop me a message. Let me know -

    How fast you can deliver

    Asking price for the job

    ------------

    Payment via paypal, on delivery

    Hope to hear from you soon!

    Adam
     
  2. Moosey

    Moosey Senior Member

    Joined:
    Dec 5, 2011
    Messages:
    1,043
    Likes Received:
    747
    Is your website powered by Wordpress? There's a plugin that can be configured for this. Let me know, I can install it and configure it for you.
     
  3. Adam.Dev

    Adam.Dev Newbie

    Joined:
    May 11, 2013
    Messages:
    4
    Likes Received:
    0
    No, it's plain old HTML/CSS - No CMS system
     
  4. MatthewWoodward

    MatthewWoodward Jr. VIP Jr. VIP Premium Member

    Joined:
    Aug 31, 2012
    Messages:
    992
    Likes Received:
    1,681
    Occupation:
    SEO
    Location:
    UK
    Home Page:
  5. Adam.Dev

    Adam.Dev Newbie

    Joined:
    May 11, 2013
    Messages:
    4
    Likes Received:
    0
    Nothing to hang myself over ;) - By keeping my EU turnover (which represents a tiny, tiny portion of the market this site is in) under a certain level I avoid the red tape, effort and general expense of having to deal with VAT.

    Also, it's for one of my porn sites. I find it easier to get models if they know there is a reduced chance of their dad/brother/mother finding them doing obscene things on the internet :)

    I actually make more money from not allowing UK members. Way to go David Cameron, keep the UK competitive!
     
  6. Adam.Dev

    Adam.Dev Newbie

    Joined:
    May 11, 2013
    Messages:
    4
    Likes Received:
    0
    Ok, so I found this guide - it tells you how to get the country data from google easily.

    Google - "brian cray find web visitors location automatically"

    It should be the first link.

    I just need someone to create a bit of code that will take that ^^ data and block access to anyone from the UK who tries to load the page. Quick payment offered :)