Blocking Referrer Spam

I knew there was something wrong. Suddenly, there were tens of visitors coming to Adventures in Play each day! I just knew I wasn’t that popular. Using Google Analytics,  I dug a little deeper to learn more about my sudden jump in popularity.

 

Google_Traffic

If you do not have Google Analytics set up on your WordPress site, I highly recommend investing the time to install it. It’s a statisticians dream, but more than that, it is a great way to drill down into your blog posts to learn where traffic is coming from and which posts are most popular.

There are a multitude of guides on how to get started. I found this particular article to be good. It offers a step-by-step guide for WordPress users:

Link:
http://www.wpbeginner.com/beginners-guide/how-to-install-google-analytics-in-wordpress/

So, I see lots of traffic but is that a bad thing?

Referrer spam is a bad thing because it represents false traffic and it messes with your Google Analytics. I’m interested in the 5 real visitors, not the hundred or so mindless bot hits.

Besides, there is an easy fix to keep these sites out. All you need to do is modify your .htaccess in the root of your WordPress website. There are several ways to go about this, but I found using the cPanel dashboard to be one of the most direct.

How to Block Span Referrers

Go to your cPanel management website and locate the Files section. This is not possible if your WordPress is hosted at WordPress.com. The steps below only apply to WordPress.org websites.

Within Files click on File ManagerCPanel_FileManager

File Manager Directory Selection window will appear.
From the Document Root for: choose your website from the dropdown box, then click GoCPanel_SiteSelect

Before we modify the .htaccess file, let’s make a backup. That way, if you mess it up, your website won’t be hosed.

From the File Manager, click on Copy.
cPanel_Copy

Next, a Copy window will appear.
Enter the destination of the backup file. I choose the name “bak.htaccess“.
Click Copy File(s) button to save a backup.cPanel_Backup

Now you are ready to edit the .htaccess file directly.
Select .htaccess and then click Code EditorCPanel_FileEdit

Code Editor window may appear prompting for the character encoding type.
For now, click edit (UTF-8 is fine for me).CPanel_CodeEdit

Now for the fun part. Insert the site referrer banning rules just before the WordPress <IfModule mod_rewrite.c> section:

Example commands to filter our referrer websites:

RewriteEngine on 
Options +FollowSymlinks

RewriteCond %{HTTP_REFERER}  ^([^.]+.)*?trafficmonetize\.org [NC,OR]
 # Add other RewriteCond rules here
 
RewriteRule .* - [F]

What is the [NC,OR] doing at the end of the statement?

  • [NC] Tells WordPress to do a case insensitive comparison
  • [OR] Is a logical OR operation

*Tip: Do not add [OR] to the last RewriteCond in your filter list.

My .htaccess file looks like this:


AddHandler application/x-httpd-php52 .php .php5 .php4 .php3
## SITE REFERRER BANNING
 # Block traffic from multiple referrers
 RewriteEngine on
 Options +FollowSymlinks
 RewriteCond %{HTTP_REFERER} ^([^.]+.)*?trafficmonetize\.org [NC,OR]
 RewriteCond %{HTTP_REFERER} ^([^.]+.)*?4webmasters\.org [NC,OR]
 RewriteCond %{HTTP_REFERER} ^([^.]+.)*?webmonetizer\.net [NC,OR]
 RewriteCond %{HTTP_REFERER} ^([^.]+.)*?floating-share-buttons\.com [NC,OR]
 RewriteCond %{HTTP_REFERER} ^([^.]+.)*?www.event-tracking\.com [NC,OR]
 RewriteCond %{HTTP_REFERER} ^([^.]+.)*?free-social-buttons\.com [NC]
 RewriteRule .* - [F]
 # BEGIN WordPress
 <IfModule mod_rewrite.c>
 RewriteEngine On
 RewriteBase /
 RewriteRule ^index\.php$ - [L]
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule . /index.php [L]
 </IfModule>
 # END WordPress

Warning: Be careful when editing the .htaccess file. If you don’t edit the file correctly, your website might not load or will inadvertently filter out otherwise welcome visitors.

Click Save and you should be all set. Be sure to test if your homepage loads properly. If you did something wrong you can always restore the backup and try again.

Zero_VisitorsNow that’s more like the blog I know!

 

Experts stumped! Weird trick that increases traffic to your site!

That was pretty much it. Disappointed? Don’t be. Here are some more sites that you simply can’t resist:

  • [expand title=”How centenarians are beating twenty-somethings at their own game“]

    Congratulations! You have fallen for the hook.

    It’s just too tempting, right?!

    How centenarians are beating twenty-somethings at their own game

    Ahh.. I really did want to know more about how those centenarians are winning… I mean beyond outliving us all.

    [Insert ad here]
    [/expand]

  • [expand title=”Is your face symmetrical? Learn how your life could depend on it!“]

    Congratulations! You have fallen for the hook.

    Is your face symmetrical? Learn how your life could depend on it!

    Did you really think that your life would depend on your face being symmetrical? Of course not, but probably some part of you was thinking that facial symmetry could be important in ways that you don’t yet fully understand. Am I talking to you from my good side?

    [Insert obnoxious ad here]
    [/expand]

  • [expand title=”Dietitians angered over amazing pizza diet weight loss results“]

    Congratulations! You have fallen for the hook.

    [Insert annoying ad here]

    Dietitians angered over amazing pizza diet weight loss results

    Wouldn’t it be great if just for once you could stick it to those smug dietitians who harp about your cholesterol and penchant for pizza. Wow, what a life it would be if you could eat pizza all the time and still lose weight!
    [/expand]

  • [expand title=”Astronomers frightened by what they see“]

    Congratulations! You have fallen for the hook.

    [Insert  another annoying ad here]

    Astronomers frightened by what they see

    Who isn’t interested in a good, “The World is Going to End” story? I mean, it’s only a matter of time, right?

    Just the imagery of it all is so tempting. Astronomer’s peering through telescopes and terrified by something, but what has them so afraid? I just need to know!
    [/expand]

  • [expand title=”What parents don’t know that could be holding their kids back“]

    Congratulations! You have fallen for the hook!

    What parents don’t know that could be holding their kids back

    And what parent isn’t interested in knowing more about the things that might hold their kids back? These type of articles love to prey upon the insecurities of parents. It implants the idea that for some reason, your kid isn’t going to succeed if you pass on this article.
    [/expand]

  • [expand title=”Educators embarrassed to learn about missing weekday“]

    Congratulations! You have fallen for the hook.

    Educators embarrassed to learn about missing weekday

    Really, a missing weekday? How could they miss that?

    I think this headline might grab you because it is appealing to learn about “know-it-all” teachers who don’t know-it-all and in the process are ashamed by what they don’t know.  

     Back > Experts stumped! Weird trick that increases traffic to your site!
    [/expand]

  • [expand title=”Man goes sixty days without left sock“]

    Congratulations! You have fallen for the hook.

    [Insert yet another annoying ad here]

     Man goes sixty days without left sock

    What man? How could he possibly go sixty days without a left sock? Why his left sock? Why did he lose his sock? What is this story even about?

    I have so many unanswered question.
    [/expand]

  • [expand title=”Get noticed at work without showing up“]

    Congratulations! You have fallen for the hook.

    [Why this would be a perfect opportunity for a well placed ad]

    Get noticed at work without showing up

    How can you get noticed at work without even showing up? This headline is sure to appeal to the Timothy Ferriss fans out there. Certainly you would get noticed for not showing up for work, but probably for all the wrong reasons.
    [/expand]

  • [expand title=”Why everything experts have told you could be killing you“]

    Congratulations! You have fallen for the hook.

    [Insert annoying ad here]

    Why everything experts have told you could be killing you

    Darn experts know everything, right? Now I learn that all this advice could be killing me!?! Isn’t that just typical? Here, I thought I was living a pretty healthy life, listening to the helpful advice of John Tesh while taking everything in moderation. Who can you listen too? So much conflicting information.
    [/expand]

  • [expand title=”What your neighbors don’t want you to know“]

    Congratulations! You have fallen for the hook.

    [Insert ad about latest amazing product]

     What your neighbors don’t want you to know

    What are my neighbors up to? I never see that guy next door until late at night and then there is the lady across the street who just bought that new, expensive SUV. What do they know and what are they hiding from me? I want to get ahead too!  Inquiring minds want to know.
    [/expand]

  • And so much more! Oh, and it’s all new too.

    So what do you think? Is your curiosity getting the best of you? Why do we find these headlines so appealing?

    Nightcap Update

    For the past couple of weeks during the wee early morning hours before the kiddos wake, I have working on my latest pet-project, “Nightcap“. I thought that the program was mostly done. I should know by now to be more cautious of this mindset. I had been running Nightcap on my two Windows 8 PCs for months now without much ado, but when I took a closer look at the code base, I knew a couple of things needed changing before the much anticipated product release. My main concern was with the event-based approach that I used to detect keyboard and mouse activity. At first it appeared to work well, but during testing on our home PCs, my little beta testers (Thing 1 and Thing 2) noticed that their computers fell asleep while playing games. Clearly there was a lot of activity happening, but for some reason Nightcap had stopped noticing.

    It turns out that Windows 8 was secretly unhooking my event monitors and replacing them with Folgers Crystals

    Well not actually that, but it might as well have. The net effect was that my app could no longer sense anything about the computer and that was kind of the whole point of Nightcap. Why did Windows have it in for my app? Perhaps Windows had deemed Nightcap a poor citizen of the OS? I did a little research and learned that in recent years Microsoft had discouraged event monitoring for programs like Nightcap for good reason. These event-hooking hogs can really slow a computer down. Microsoft recommends using Raw Input instead of events hooks because it doesn’t hamper system processes and provides a more efficient way to delivery device messages. Reading over the documentation, I could see that this approach was radically different than event hooking. Being so close to completing my app, I was desperate to find a quick-fix. Clearly, I wasn’t the first person to write an app that used event monitoring. I wasn’t thrilled about reworking the core of my app when it was 99% there. After a quick search, I learned about a workaround where you can fudge a registry setting to set the bar so low that no process, however laggy, would ever be unhooked. The “fix” worked, but the hack never sat well with me. I had sort of forgot about that workaround while I was in the final push to get Nightcap up on my website. Without this hack, I imagined thousands of computers inadvertently falling to sleep while folks were playing games or composing emails. Bottom line, this was no way to release Nightcap.

    Which brings me to last week… I did some more research and decided that Raw Input processing was definitely the way to go even if I had to rewrite Nightcap. Unfortunately, the API was written for C++ and if I were to use it in my C# app, I would have to come up with a way to integrate the unmanaged code. Being new to C#, that was a learning process in itself, but I stuck with it and got the raw input code to work within Nightcap. However, after some initial testing, I noticed Nightcap had stopped responding to click events. Somehow the WM_INPUT handling was interfering with the normal event processing. After a few days of trying out various C++/C# incarnations without much luck, a new plan started to emerge. I thought,

    “What if I separate out the event processing part of my app from the reporting and configuration piece?”

    image

    Eureka! I can write the input event monitoring as a Window Service and leave the C# app as-is. Only now, the visual aspect of Nightcap would interact with the behind scenes service to tell it under which circumstances to put the computer to sleep. The nice part about this approach is that the monitoring part of the program will be active even when no one is logged in. This comes in handy if your PC wakes up in the middle of the night because of LAN activity.

    My blog has been neglected for the past couple of weeks, so I felt an update was in order. I hope to have a beta version of Nightcap on my website by May. As a side note, I really enjoy working with Microsoft tools once again. Visual Studio 13 is fun to work with and in my experience is the best programmer’s workbench in the industry. Debugging code is so well done and I really like how git has been integrated into the IDE. Nice work!

    Well, I am getting back to it now. 

     

    RGD: Week in Review

    I somehow managed to finish a game this week. Now, I am not all that proud of the game, but my son thinks it’s cool, so I am going with that. The game is called “Grape Boy” and  its premise is pretty simple: You play Grape Boy, a character who catches grapes in his mouth. The more grapes you catch, the higher your score. If a grape hits the ground, Grape Boy loses a life.

    grapeboy

    When I started the week, I had all kinds of “fantastic” game ideas but as time went on and I worked through my lofty game designs, I could see that I needed to simplify. Thus Grape Boy was born.

    Panic set in around Monday evening. It just didn’t seem possible that I was going to complete a full game in a week using traditional programming techniques. I needed a plan B if I was going to make good on my commitment. That’s when I gave Construct 2 a go. I briefly experimented with the game construction kit about two years ago and thought it would be easy to pick up (maybe wished would be a better description). Through the years, I’ve learned that with software development there is always something to fight. There is no such thing as painless development. Frustration is a constant. The folks at Scirra have done a fantastic job of making a very powerful and “easy” to use game kit. If you don’t have a programming background I suspect using Construct 2 is the easiest way to go. For me, it was a different story. I had to restrain my desire to write code and figure out how to accomplish the task using events sheets and layouts. Having a full time job didn’t make it any easier, but I couldn’t let lame excuses get in the way of my goal. I had hoped that my focus on fun would somehow make everything go smoother… No, fun as game development was, there were a lot of hours of “Why doesn’t that just work like in the example?” or “I can’t believe it’s so hard to do this simple thing” and a few hushed expletives as well. I spent most of the week just learning how the game tool worked, but I felt confident that if I stuck with it, Construct 2 would pay off in the end. Grape Boy doesn’t have all the features that I would have liked, but it is a complete game and that was my goal. I wished it had sound and more play elements, but I ran out of time and decided it was better to post a little game than no game at all. I am proud that I was able to add a high scores feature. Now you can try to best my high score. I love a good competition! 

    The whole experiment had unexpected rewards for me too. My son caught the game development bug and started writing a game of his own. He is working on his latest masterpiece as I write this post. Thing 1 is a natural gamer and is amazingly talented. One minute I look over at his monitor and he is playing Supreme Commander and the next I see him polishing off an amazing looking space game. All without asking me a single question. I am in awe of his creativity and imagination. I can’t wait to see what he will create next. In the near future, I will be posting his latest creations to AdventuresInPlay.com/games.

    Well, this week I plan to take a break from game development to finish off my taxes and take care of my to-do list.

     

     

    RGD: Day 1 Report

    OK, it’s Tuesday and I need a change of plans! I had a case of the Munday’s yesterday, so not too much to report on the game front. I did however get an email from Gamasutra informing me about a great deal at Yoyo Games where you can get a copy of Game Maker Standard edition for FREE until March 2, 2014.  I downloaded and installed Game Maker just to try it out. The really neat thing about Game Maker is that you can write games for Mac or Windows without a single line of code. After trying it out for an hour, I could see some real potential in Game Maker for my rapid game development projects. However, I feel the time pressure to get something done for Sunday, so I don’t want to spend too much time learning a new game development environment. That’s when I remembered another great tool for quickly creating games called, Construct 2 by Scirra. With Construct 2 you can create non-commercial game for free for multiple platforms. The really great thing about Construct 2 is that your game came be played on almost any platform without an installation. The free-edition does have some limitations, like limited program events and limited platform support but overall this is a great tool for my gaming projects. There is a learning curve to using Construct 2 as well, but I did some of the tutorials a couple of years ago, so I think I can get a game up and running without too much fuss. So, I’ve decided that my first gaming project won’t just be playable on Macs, you’ll be able to run my game from Adventures in Play without any installation on your computer. 

    Now, I need to get back to it and finalize my game concept, but first I have to go to work. I’ll report back tomorrow with some screenshots of my initial game ideas.

     

    Rapid Game Prototyping

    Experiments from the Blogatory

    This week I’ve decided to try something a little different.  So far, I’ve written career posts and whined a bit about my PCs and that has been great fun, but when I created Adventures in Play, I wanted to create a segment that focused on fun stuff that I like to do in my spare time. The problem for me, is that like many, I don’t have a lot of spare time and lately I have been exercising a lot of down-time watching the Olympics and Netflix (I discovered Farscape this week) shows. Mind you, watching the Olympics has been a lot of fun and to be honest, I am going to miss watching those athletes do their thing. It inspires me to be superfocused on my goals. Speaking of being super-focused, have you heard of rapid game development? Back in 2005 I read the now classic article “How to Prototype a Game in Under 7 Days” (still a terrific treatment on the subject). I’ve always meant to run my own game prototyping sprint to hone my game development skills, but I’ve never really had the time or frankly, discipline to commit to a crazy development schedule. Some of the recent articles I’ve read on rapid prototyping have gone to greater extremes, writing a game in one weekend or 30 games in 30 days. I guess it’s a matter of preference, but I do have a day job and would like to spend time with my family.  So, my revised plan is to focus on the fun and return to the original goal of one prototype in 7 days. My focus for this experiment is to have fun while writing a simple game for the Mac. Really, what do I have to do in February besides get my taxes done early and wait for winter to end?

    Experiment #1: Creating a game in 7 days

    new_game

     My Rapid Game Prototype Commitment:Spritekit

    1. Write a simple, yet complete game in one week.Spritekit
    2. Create a game for the Mac using the SpriteKit framework.
    3. Have fun!!! Although I am genuinely interested in becoming a better game developer, my motivation for this experiment is pure whimsical fun.
    4. My kiddos (Thing 1 and Thing 2) will judge my game at the end of the week giving my game a fun-factor score.
    5. Make my game available to the public for general enjoyment!

    I plan to give daily updates on my progress, so check back here tomorrow or follow me on Twitter (@runstop) to see how I am doing.