Testing out Gmail's Priority Inbox

Follow me

Referrer Detector

Note
Referrer Detector news and update have been moved to its own homepage. This post is no longer updated, and my support here will be limited. Please update your bookmarks.

It’s been a while since the last time I updated this blog (read: portfolio & more). No, I wasn’t playing stock, I’m simply not that good in economic stuffs – do I need to mention about THE crisis? And I wasn’t watching the election neither (I know that Obama won however, through some stories on Digg). Of course, he seems to be very fond of technology, and that’s one reason why he was able to defeat poor old Vietnam War soldier Mc Cain, but do I really care? Nope.

The story is (ssh!), I was too busy writing this plugin: Referrer Detector! EARTH BREAKING!!! There! Tada!!!

Ok, since that doesn’t seem to impress you much, let me introduce a bit about it.

Introduction

Here, if you do a quick search on Google for the terms “smashing magazine”, you’ll get a bunch of great articles (naturally). Clicking on one of them, for an example “100 Excellent Free WordPress Theme”, will take you to the site. Then, the most interesting part is you will be welcomed with a greeting box, like this:

Smashing Magazine's Greet Box for Googlers

If you’re a Digger, and you’re coming from Digg.com, you’ll be welcomed with this box instead:

SmashingMagazine's Greet Box for Diggers

As you may have guessed, it’s not only cool but also a very good way to attract and keep loyal visitors on you blog. Personally, I would tend to digg the story right away if the blog welcomes me with something that sweet.

If you’re wondering, Smashing Magazine is a WordPress-based blog, though I’m pretty sure that they have greatly modified their WP installation to fit their needs. And if you’re still confused, those greet boxes were brought to us by a great WP plugin called (yes) WP Greet Box perfectly done by Thaya Kareeson. Well, actually it’s something that I’ve just discovered not long ago. When I first saw noticed the greet box in SmashingMagazine, I was thinking they did it themselves and thus the thing may not be opensource. I was totally wrong, as said, but I knew it only after half-finishing my own plugin that mimics that greet box. So despite of the fact that WP Greet Box is so great already, I’ve managed to complete my own after one week.

Features

To be fair, what my Referrer Detector and Thaya’s WP Greet Box have in common are:

  • The targeted purpose: Displaying a greet box to welcome users who come from different sources.
  • The technique behind: using JavaScript’s document.referrer property.
  • The look-and-feel: from the beginning I was heavily influenced of the box on Smashing Magazine.
  • The basic configuration: both offer the ability to add/edit/remove multiple greet box instances (I call them “entries”).
  • The ability to work with caching plugins: both use JavaScript for the boxes, which is normally not cached.

What WP Greet Box has that are far better than Referrer Detector are:

  • The ability to display a message for a new visitor, regardless where he comes from.
  • The ability to specify a time interval to “forget” a visitor.
  • The ability to use Regular Expression to exclude some URLs.
  • The ability to customize the HTML code before and after the greet box.
  • The author’s skill!

What my Referrer Detector have which may be a bit more convenient for users are:

  • The AJAXed admin interface. Entries can be added/modified/(de)activated/deleted without the need to reload the entire page.
  • The greet box position can be set to before or after the post. A custom tag can also be used in case you don’t want to show greetings on every post.
  • The ability to include WordPress attributes like url, title, author, category etc. into the greetings
  • More installed-by-default entries. Upon installing, you will have these entries available:
    • 9 rules
    • Del.icio.us and Delicious.com
    • Digg
    • Gizmodo
    • Google Search
    • Lifehacker
    • Live Search
    • Reddit
    • StumbleUpon
    • TechCrunch
    • Technograti
    • TechRadar
    • Twitter
    • Yahoo Search
  • It works for me :) Yes, I don’t know why WP Greet Box didn’t.

Installation

As usual

  1. Download the plugin,
  2. Extract into a folder,
  3. Upload it to wp-content/plugins/ directory of your WordPress installation,
  4. Enable it via Plugins panel,
  5. It should now work out of the box. If you want to tweak a bit, head to Settings->Referrer Detector.

Configuration Usage

Add/Edit an entry

To add or edit an entry, you’re provided with a simple form with 5 fields.

  • Name: The name of the entry. Digg, Google, Yahoo… are good names.
  • URL: The URL of the site where your users come from. For this to work, the URL must not contain those prefix and suffix like “http:/www” and “/?q=etc.”. To be clear, it should be “digg.com” instead of “http://digg.com”, and “google.com” instead of “http://www.google.com/search?hl=en&q=some+keywords”. Furthermore, the domain and subdomain are treated differently, which means different greeting boxes (if any) will be shown for “yahoo.com” and “search.yahoo.com” users.
  • Message: The greeting text for this entry. These HTML tags are allowed: <div><h1><h2><h3><p><span><a><ul><ol><li><hr><br><table><thead><tbody><tfoot><tr><td><th><strong><em> Also, these tags may be used:
    • {url} - Full URL to your WordPress post, for example http://yousite.com/2008/10/my-first-post. Very handy if you want to ask your users to digg your post.
    • {title} - Title of the post, for example My First Post.
    • {link} – Link to the post, for example My First Post. It’s just an combination of {url} and {title}.
    • {categorynames} – Names of the categories under which the post is listed, separated by a comma. Example: Cats, Dogs, Pets.
    • {categorylinks} – Links to the categories under which the post is listed, separated by a comma. Example: Cats, Dogs, Pets
    • {authorname} – Name of the author of the post, for example Mr. Cool.
    • {authorurl} – URL of the author, for example http://mrcool.com.
    • {authorlink} – Link to the author, for example Mr. Cool
    • {search-terms} – The search terms user used to find your posts, as shown in the referrer.
  • Icon: The URL of the icon to display beside the greeting text. If this is left blank, a default RSS icon will be shown. Though any image will do, it’s recommended to use a small one (48×48 px should be perfect).
  • This entry is active: The name says it all. Naturally, this should be checked.

Generic Options

Those options are used to specify if you want to show the greeting box on every post, page, before or after… Notice that if you can include a {referrer_detector} anywhere in your post to show the welcome text. If the visitor didn’t come from any of the referrers, don’t worry, the plugin is smart enough to hide that ugly tag from your post.

Screenshots

Referrer Detector - Entry List
The entry list.

Referrer Detector - Edit an entry
Edit an entry.

Referrer Detector - In action
Referrer Detector - In action
Referrer Detector - In action
Referrer Detector in action.

FAQ

Q: It just doesn’t work!
A: Sorry to hear that. However, I can only help if you provide me with more information, like under what circumstances, what are your settings etc. If it’s a bug I will try to fix it.

Q: Will it work with my cache plugin?
A: It should – just make sure you delete the cache right after plugin activation. As I mentioned before, a cache plugin only caches the server content as a static HTML file. As Referrer Detector uses client-side JavaScript, it should work regardless if the page is cached or not. If in any case it doesn’t work with a specific caching plugin, please let me know. And FYI, I’m using Wp SuperCache right now ;)

Q: How do I change the default icon? I’m sick of that RSS thing!
A: The default icon file is wp-content/plugins/referrer-detector/images/icons/default.png. Re-decorate however you want.

Q: How about the CSS styles of the greeting box?
A: Check wp-content/plugins/referrer-detector/css/style.css

Q: Where did you get the icons?
A: Instead of grabbing them from FastIcon, I did them myself for my own sake :) If you want to create more icons with the same style, here is the original PSD file.

Q: Just curious, how did you test this plugin? You don’t have back links from all of those referrers, yes?
A: Of course I don’t – I’m not that famous. Instead, I use the great Firebug to inspect and modify a link on those sites to link to my post, and there I have a good referrer ;) If you have a better and quicker solution, please let me know.

Q: What do you have in mind for the next version?
A: A default greeting for those that don’t have a matching referrer – configurable. Maybe something more.

Q: I like this plugin. How do I support its development?
A: Thank you! Please consider putting a link back to this blog. And please note – the initial credits go to Thaya Kareeson and his great WP Greet Box plugin.

History

To save myself from some extra work, the history is now available only here at the WordPress codex. Sorry if this makes any inconvenience!

Download

Referrer Detector can be downloaded at WordPress Codex here. If you find it useful, please give it a 5-star rating ;)

Whether interested in ccna or mcitp certification, using braindump you will pass certification exam in first try guaranteed.


  • Nifty. I’ll try it out for sure.

  • hi. Thanks for plugin

    perfect.

    Regards

  • its not working in my site sunipeyk.com.
    Do other plugins could effect?

  • Hello! I just gave this a spin and I like it, but I ran into a couple of problems getting it to work.

    1. Most critically, the plugin requires write permission to its js subdirectory or to js/data.js (which does not exist in the archive). A lot of hosts do not allow write access by the web server account except on a case-by-case basis, so this needs to be included in the installation directions.
    2. The PHP file doesn’t have a close tag. Either that or I got an incomplete file from the archive.
    3. All the feed links in the default entries are preset to point to your feed, rather than picking up the feel URL of the local blog. So I had to go through and change them all, one by one. This should either pick up the URL from WP settings, or should be mentioned in the directions.

    Anyway, once I fixed those issues, it worked great, except for one more problem: If it’s set to show on every post, and the landing page has more than one post — say, it’s the home page, or an archive page — the notice appears for each and every post, all using the first post’s URL. Unfortunately that makes it impractical to use on one of my sites which has been getting a lot of traffic from StumbleUpon to the home page lately.

  • I wanted to only show the message once, at the very top of my posts (between the header, and the title of the first post). So I disabled the “show in every post” option and then put {referrer_detector} in index.php, but all it does is actually show “referrer_detector” on the site, and it shows up regardless of where the traffic comes from or even if you go to the site directly. How can I fix this?

  • Hi sunipeyk,
    Could you explain a bit more in details, so that I can try to fix?

    Hi Kelson,
    1. Thanks for your suggestion. This will be instructed in the next version (coming soon)
    2. It’s nothing but my coding habit. As Zend specified, a PHP file does not require the closing tag, and should not have to avoid session problem when including.
    3. My bad, my very bad! Will be fixed.

    The remaining problem with homepage is being fixed by me. Thanks for all!

    Hi Study Babes,

    The tag {referrer_detector} is intended to use in the *post* content itself, not in the theme. Here you’re putting it into index.php, so it can’t take effect.

  • mmm… i activated the plugin, test it from twitter. Nothing appears. :(
    May the other plugins cause it?

  • Hi SuniPeyk,

    May I know your blog link (best is a link to the post which *should* have greetings)?

  • sure, http://www.sunipeyk.com
    twitter : http://twitter.com/sunipeyk , choose any from the twitter all are from my blog…

  • SuniPeyk, I see the problem.
    On your twitter page, all the links are in TinyURL format. This way, users who click on the links will be directed to TinyURL.com, and from there redirected to your site. So the referrer in this case will be tinyurl.com instead of twitter.com, which is the reason why the greeting box is not showing up.
    Unless you decide to add a “tinyurl.com” referrer and welcome user with Twitter message, or use full (long & real) url on Twitter, I can’t see a way to get through this.
    Hope this helps ;)

  • oh… i really like your plugin and i love the idea behind it , and am sure that you make good … but…
    the tinyurl dont work too. i also try with frienfeed, google.com.tr , search.yahoo.com … but nothing appears. :(

    any way thank you for very quick replies :)

  • SuniPeyk, I’ve checked through your page’s HTML source code and see that somehow the mandatory javascript files are not included.
    Could you please send me the file wp-content/plugins/referrer-detector/referrer_detector.php? Also do you suspect any plugins installed?

  • i tried WP Greet Box , its not working too. i am using landing sites plugin. i think its the only reason can be.

  • sorry maybe you looked at codes of my site while i deactivate the plugin…

  • My top suspect is your theme is not calling to wp_head() function. May I ask what theme are you using?

  • That sounds like a great plug-in. Thanks for sharing.

    By the way, the site designis so cool…
    Cheers

  • :) )) damn me , yes wp_head() function solves it all :) )
    i am using default theme but i rewrite almost all part and pages

    all working great thank you very very much for all your help and this lovely helpful plugin.

  • They say imitation is the best form of flattery

    :) That being said, I’ve made some enhancements in WP Greet Box (version 4.0), that makes some of your feature comparisons outdated.

  • Thanks a lot man! Your plugin totally rocks! I’m going to feature your plugin in my upcoming top wordpress plugins linkbait post :D

  • Thanks, I’ll check out the new version!

  • Hey phoenixheart, is there any way to get it to only show like how I wanted it, one time at the top of the posts?

  • Hi Study Babes, I’m definitely thinking about more flexible options in the new future. Your idea is on top of the list ;)

  • Great idea, this plugin look good and i will try and comment here

  • You need to correct the name of the file related to delicious…its broken.

  • Hi,
    This is a great plugin, and it’s working like a charm.

    I have a question though, when I activate the message to be shown to the googlers it’s shown also to the visitors from Google Reader, which is not good since they already subscribed to my feed. Is there a way to exclude google reader visitors from seeing the message?

  • Hi iTalal, and thanks for your compliment! For your question, I’m implementing that feature in the very next version of Referrer Detector. In the mean time, if it’s vital for you, I recommend Thaya’s Greet Box, it has that great feature included already ;)

  • wow! thanks for the fast respond :)
    The new update has exactly what I was looking for.

    Thanks a lot!

  • another question:
    when people search and landed on the main page, is there a way to display the message on the main page too?

  • Hi iTalal, yes it’s a new feature available from version 2.0, as specified here: http://www.phoenixheart.net/2008/11/here-it-is-referrer-detector-20/

  • Wow great plugin! Just installed it on http://www.howtomakemyblog.com and it works perfectly! Thanks!

    Marko

  • how can i upload a new theme on wordpress plz explain i am totally new to this factor!

  • Real good one buddy, keep the plugins coming!

  • Hi all,
    Thanks for you invaluable support ;)

    Hi Adeel,
    All you need to do is upload the theme folder onto yoursite.com/wp-content/themes and then activate it via Design->Themes admin panel.

  • It’s a great job, thank you phoenix.heart .

  • I tried installing it and had this error appear:
    http://screencast.com/t/GlcHkuuqn1

    Anyone know what’s happening?

  • I love the plugin and just wanted to give you a heads up over a possible security flaw. This guy on dailyblogtips said the following (granted I think he’s upset),

    “Honestly, I am quite disappointed that my plugin hasn’t done better in the WordPress community. I am also even more shocked[upset] that Referrer Detector got the word out much quicker than WP Greet Box. I guess it really does matter “who” you knows in the blogging community.
    I don’t want to sound biased, but as of right now (Referrer Detector version 2.1) I believe that WP Greet Box is hands-down better than Referrer Detector:

    1. Referrer Detector has a security flaw in its administrative AJAX interface. I won’t say more, so hopefully people with Referrer Detector installed won’t get hacked.
    2. WP Greet Box works with WPMU.
    3. WP Greet Box has the ability to keep track of visitors, so the visitor referred from google will not keep getting the same greeting message if they have visited within the last X hours.
    4. Exclusion rules have regular expressions support.
    5. More solid default CSS. ”

    Should we worry about our sites being hacked????

  • Thanks for your information, Blain. I wrote a new post about this here: http://www.phoenixheart.net/2008/12/referrer-detector-211-and-a-little-bit-more/
    About your last question, I will answer: no :)

  • Umm, perfect. This is a perfect plugin, thanks. Well,one thing, but it is not really a big deal I use Lighter Admin and the menu doesn’t work when I am configuring this plugin.

    Just for completeness sake.

    Thanks again,

  • great work, thanks for plugin

  • Updrade to 3.0.1 throws the following error:

    Fatal error: Call to undefined function: get_options() in /hermes/web03/b387/pow.XXXXX/htdocs/radionx/htdocs/wp-content/plugins/referrer-detector/referrer_detector.php on line 19

  • My bad… I totally messed up the code. Fixed it 3.0.2.
    Thanks for your information!

  • hi love the plugin but i cant get it to work. When i activate it i get this: Cannot redeclare rdetector_install() on line 95

    any ideas?

  • Thanks for the great plugin. Unfortunately, it stopped working on IE7 at some point. Google search for “nick bostic” works fine on Firefox and Chrome, but doesn’t pop up on IE. Any suggestions?

  • Hi Nick, it seems to work with me on IE7. Do you suspect on anything? :)

  • Great plugin but unfortunately not useable for me at the moment as it breaks the livesearh and the livecomment functions i use on my theme. Maybe you have the time to look this up in details sometime?

  • I’m really impressed by how upfront you are listing the advantages WP Greet Box has over Referrer Detector & being completely transparent about which features are directly inspired by the former.

    I find this level of openness & honesty quite rare & really very refreshing.

    Thank you!

    Kx

  • Hi Kathleen,
    Thank you for this comment. Both WP Greet Box and Referrer Detector are growing and have different features aside of common ones, so I’m always encouraging users to choose the one that fits their needs the most – as so is Thaya the author of WP Greet Box. We’re living in an open world so I think it’s only better for the whole community :)

  • Hey thanks for the great plugin!

    Does this work on WordPress Mu sites too?

  • wow.. its a cool plugin, it’s really fit for create a relation to the new reader

  • Hi,

    I finally got it to work.

    I would like to suggest that, with url “*”  in the add entry, we can show a greeting on every page. Please add this into your next releases as disabled so that users wont have to figure that out.

    And a question, How can i show more than 2 greetings for a page?
    Lets say for a twitter follower,i would like to show extra RSS feed greeting too.

    Thanks,
    EnLi

You can follow any responses to this entry through the RSS 2.0 feed.

Trackbacks / Pingbacks