Custom alerts for naughty visitors

Custom alerts for naughty visitors

The other day I discovered something unusual: according to our analytics we had 74 visitors to from a link on (a website for finding freelancers). I followed the link back and found the following posting:
Elance posting

I'm looking for a responsable(sic) web developer with experience in Java, JavaScript, Ruby on Rails, and other relevant programming languages to build a legal online marketplace website similar to the following site:

That's right. Someone wanted to commission a freelancer to COPY LEXOO - (in Ruby on Rails no less!) They say that imitation is the highest form of flattery!

In response to all these elancers visiting our site to copy it, I pushed up an alert that would only show for visitors who came to our site via this job posting.

Welcome Elancers

Welcome Elancers - thanks for popping by! Need copyright advice? Please contact us ;)

Postscript: I'd like to know how much the winning bid was. I mean, how hard could it be to just build Lexoo? If I did it, surely anyone could!

Double postscript: every day we've been getting fake enquiries through Lexoo from elancers testing out the system to see how it works. It's now starting to get a little annoying!

Triple postscript: looks like they're getting tonnes of proposals! (45 so far)

Quadruple postscript: Dom Mason pointed out that these components are called Welcome Mats. Thanks Dom!

If you're interested in how to do this yourselves with Ruby on Rails - read on:

## Creating custom alerts for visitors

So, first of all you need to find out how they got to the site. The elancers were all getting referred by, so I checked the requests referer variable:

Next I added a div to the top of every page by adding it to the application.html layout:

Then I used the jquery sticky alert plugin to display a nice alert to everyone that visited: