Google Analytics filter: Include all traffic from an IP address

I’ve started my internship at a big school that recently implemented Google Analytics (GA). When we looked at their data we saw that many pageviews simply came from employees visiting gateway pages to internal services. Also, because we don’t have a comprehensive intranet right now many employees and students look for information at the public website. We needed a way to remove all internal traffic from our GA data.

This turned out to be easy. Google Analytics offers this feature right out of the box. On the Analytics Settings page for your account simply navigate to the filter manager and choose the ‘Exclude all traffic from an IP Address’ filter. The fill out your IP range. Some regular expression magic is needed here but there’s plenty of documentation about that to be found. A good tip is to create a new profile for the same website and apply the filter to this new profile so that you never loose any data: you’ll still have your original profile without filters.

Now that we had this sorted out we figured it might be kind of cool to also have a profile that only displays data about internal traffic. Google Analytics doesn’t offer this feature out of the box. Luckily there’s a workaround. Create a new profile for the same website again (add website profile -> add profile for an existing domain), and create a new filter. Make this a custom filter and choose Include as the filter method. Then choose Visitor IP address as the filter field and enter the same IP range you used for the exclude filter as the filter pattern. Now apply this filter to the right profile and you’re all set: you now have a filter that will only show traffic from a certain range op IP adresses. Hope this helped!

Recursive delete with the command line windows FTP client

If you’re dead set on finding a way to do a recursive delete with Windows’ standard command line FTP client you’re in the wrong place. Actually, the whole internet is the wrong place for you. Why? It’s simply impossible to find a way to do recursive deleting of directories in ftp.exe on the Internet. Well, I’ve searched high and low and couldn’t find it that is. If you can, I’d love to hear from you.

What I did find however is a way to achieve the same thing with a simple different FTP client.

At my job someone was looking for a way to delete all contents from a certain directory. This directory contains files and more directories (which in turn can contain more files and even more directories). This is easy if you’re working in a graphical FTP client like FileZilla but in our case it had to be done with a script. This meant we needed to work from the command line. Windows’ standard FTP client simply didn’t work. As long as a directory is not empty, it can’t be deleted. There are probably complicated scripts that can be written to do what we want but we’re no guru’s and we couldn’t find them by means of Google.

After a lot of searching we finally found our answer. I knew that the linux based FTP client LFTP does what we want with a built in command. All I had to was find a way to run it in Windows. Finally Google was my friend again. It didn’t take too long for me to find a windows version of LFTP. It’s in a ZIP file and it can be downloaded from here.

When running the included install.bat, Windows complained a little but that didn´t stop the program from working. I did need to specify the full path to the exe (for instance C:Windowslftp.exe) in order to run it. Now you could write a script like this:

debug 10
user <user> <pass>
rm -r <directory>

And after saving the script you can start LFTP like so:

C:Windowslftp.exe -f <script_file>

I assume you’ll understand that you’ll need to replace all text that is enclosed <like this> with their corresponding values (so replace <user> with the username to connect with and <pass> with the user’s password)?

For more info on using LFTP try the documentation or this page (with scripting examples).

Please let me know in the comments if you’ve found other ways to achieve the same thing (perhaps with Windows’ standard FTP client?). Hope this helps!

Nicer MySQL administration with SQL Buddy

I hate using PHPMyAdmin to adminstrate MySQL databases. It looks ugly, it’s unintuitive and simply not user friendly. And still it was still the tool I used to do this very task. I thought there was no good alternative. SQL Buddy seems to offer just that. A nicer way of administrating your MySQL databases.

SQL Buddy is AJAX enabled and refreshes only the portion of the page that needs it. This alone makes for some reduced loading times. However it does play nice with bookmarks and the back button (in the same way that GMail does). When browsing your data you can resize the table columns and sort the data on the fly. One other thing I really like is that it allows you to hardcode your MySQL password in the config file. This shouldn’t be used in a production environment ofcourse, but it’s pretty nice when you’re on your local testing machine. It also doesn’t log out after 15 minutes of inactivity like PHPMyAdmin does.

I’m sure there are some features that PHPMyAdmin has and SQL Buddy doesn’t. But still, it can’t hurt to try it out and you can always run the two side by side ofcourse!