Dustin had a post last night that made me rethink the ideas I posted the other day on using a cookie to modify a WordPress.org weblog’s default behavior for first-time visitors.
Clear as mud?
Starting with version 2.0, WordPress introduced the idea of an optional intro.php file that would be a sticky first post. In other words, the file, truly a pseudo-post, could be shown first to every reader who landed on the top-level page of the weblog. That way, you can do all your welcoming house-keeping with new users.
Too cool. What’s the problem? Most people showing up at your weblog are not new users, so you’re going to hammer that intro.php nail into their heads again and again.
And Dustin raised another problem: Many people arriving at your weblog for the first time will be coming in from search engines, from your RSS feed or from deep links on other sites. Those folks are never going to see intro.php, because they won’t enter the weblog from the top level.
The code I wrote the other day solved both of these problems, but with a one-size-fits-all solution. What if you want to issue a special introduction only to top-level first-time visitors? What if you want to address only those people coming in via deep links into your weblog? What if you want to say something different to each type of visitor?
I amended the code today to take account of these two different entry scenarios. Using this version you can have an intro.php file for people who enter your weblog for the first time through the front page. The cookie associated with that expires in 60 days, so that only people who have been away for a long while will see it more than once.
You can also have another file called singlePostIntro.php (or whatever) for people who come in via a hard click from a search engine, an RSS feed or another web site. That cookie lasts for two weeks. The point is to address infrequent visitors who come in via deep links differently, in the hopes of persuading them to become subscribers.
You can see this version in action at Distinctive Phoenix. We’re assuming that top-level entrants are coming at least modestly pre-sold on the idea of the blog, so we’re closing on the idea of becoming part of the community. For deep-linked entrants, we’re asking for a smaller commitment: Since you’re already here, stick around to see what we’re all about. In both cases, the idea is to guide the first-time visitor toward greater involvement.
Both cookies are set on every entry, so you’ll have to clear the two cookies after every entry to see the alternate behavior.
And: Where the two introductory files at Distinctive Phoenix are all text, those files could contain any PHP that will run outside of the WordPress “Loop” — globally-available WordPress functions, calls to plug-in functions or custom PHP coding. For example, you could parse an inbound URL for a search string, then craft a link to an internal WordPress search on that keyword. That would make everything you have on the subject available, where the external search engine only targeted one post.
In principle, all of this is really straightforward. The tricky part is that no two WordPress themes are exactly alike. If you want to play with this code — and you don’t blanch at the idea of playing with code — say so.
Technorati Tags: blogging, real estate, real estate marketing
Tom says:
Interesting work Greg.
The idea of changing the page for new visitors is interesting but also disconcerting to me. I have not added any of these features as it would be off putting to me if I was searching on a topic in Google, ended up at someones site and I had a sales push before I could see the data that I was in search of.
Now of course spending much of my time on the internet that I am not the atypical user. I do like the verbage on the distinctive site. Great job there.
July 19, 2007 — 2:55 pm
Ian Stewart says:
Thanks for this Greg. How would I go about making the intro and single-post-intro a little stickier? I’m thinking 3 visits before they disappear but with the same expiry date.
Plus, where’d you get that subscribe without commenting plugin? That thing is great.
July 24, 2007 — 10:31 am
Greg Swann says:
Subscribe2Comments, a killer plug-in.
For the cookies, you could try this (I have not tested this code):
Set the cookie like this:
setcookie("longTermVisit", (longTermEntrant+1), $cookieExpiration);
Then check it like this:
if ($topLevelEntrant < 3) { ... } That way, if the visitor has been to the site 0, 1, or 2 times, they'll get you stickifying content, not otherwise.
July 24, 2007 — 11:05 am