Use standards

Use standards

No, you guessed wrong. This will not be the nth post about W3C standards.

Well, maybe one paragraph: while I know the use of W3C standards is favourable, the usability of your project/application should be your number one priority. Not adherence to a standard which would render your application unusable for (a part of) your audience. Every once in a while people tend to forget this. Of course no one will argue that W3C standards actually are a blessing.

But, this post is mainly about 2 simple standards:

  • The ISO 639 standard for representing languages. Please use “en” or “fr” in your database, routing, scripts,… . It is unbelievable how many times people pick something like “FR” or “F”.
    Next time, consult the ISO 639-1 list.
  • The ISO 3166 standard for representing countries. Same case: please use “US”, “FR” or “BE” or use the ISO 3166-1 list.

Additionally, use the Unicode CLDR list when working with locale’s (e.g. nl_BE).

Standards in general provide a major productivity benefit: you do not have to lose time discussing, implementing, mapping,… other peoples personal preferences (whether or not their choice can be motivated).

This also applies to coding standards/guidelines. We have probably all had (or will have) discussions about them once in our life because there are no “official” ones as far as I know. Specifically about PHP: please (yes, I am on my knees right now) use one of the major ones that are already available: e.g. Zend Framework (my preference because it is or will become the industry standard), PEAR or … . Do not create your own flavour (I do not have to explain why this does not make sense).

A hot topic at your company, project or team? Have a look at Weble Subversion hosting: you can force a list of predefined guidelines/standards by a mouse click. This will prevent SVN users from committing their code if it does not comply and, in such a case, an overview of the deviations will be displayed.

Practical use of QR codes

Popular and widespread in Japan, QR codes (a variant of the well-known bar-codes) certainly provide many opportunities.

strictlyphp-qr-code

The QR code was invented by Denso Wave, Inc of Japan in 1994. They appear on many product packaging in addition to “normal” bar-codes for shipment tracking and other purposes. When scanned, these codes can return numbers and text (e.g. the URL to this blogpost in the example image). The camera on your mobile phone and dedicated scanning software do the rest of the magic.

While their ability to be a link between the “online” and “offline” world can provide many opportunities, it hasn’t really become the hype it could be outside of Japan. Practical implementations are rare. Most likely because of the lack of knowledge by the broad public. Although QR reader software is freely available and a July ’09 research by the University of Essex stated that 68% of UK phone owners can install such an application, most have not.

The biggest difference between the numerous free QR readers (for about any phone brand/model) may be the image quality needed to recognize a code. I’m happy with the  speed of NeoReader but there are also Kaywa Reader and QuickMark barcode reader (among others).

Besides WordPress plug-ins and support in the Google Charts API, there is a PHP library but support in the Zend Framework could stimulate its use even more (Zend_Gdata_Chart anyone)?

Some more implementations:

One useful tip is to shorten URLs through one of the many URL shortening services there are. This generates a smaller, less prominent QR code.

PPC campaign for Bed and Breakfast

The name or URL strictlyPHP may not immediately reveal I have a second online passion: Web Analytics.

I am more than aware a proper site would help clarify what I do and it’s certainly on the list, but for now, a short description: besides PHP/Web development, I try to invest as much time as possible in Web Analytics. In my case summarized as: website optimization using Google Analytics.

I am extremely fascinated by the information you can derive from analysing data/traffic. I like to pin-point possible usability issues, missing information or missed opportunities to improve site conversion performance. Related to that, targeted AdWords PPC (Pay-Per-Click) campaigns are lots of fun too!

De Pastorie in Haspengouw

And that is what made me write this post: I just started a new Google PPC campaign for a small Bed and Breakfast in Haspengouw (Belgium) targeted to Belgian and Dutch people.

The conversion action is of course the use of the contact form and as results are coming in, it’s doing well. I did a small site rebuild in advance so not everything can be compared to the past, but the amount of new not-bouncing visitors has almost doubled and conversions (of course!) follow the same path. While traditionally March and April were their best months, July is coming close.

Conversions via phone are currently not measurable but it’s easy to ask the person that handles them if an increase is visible (audible?). You could do this properly by asking those people if they visited the website before. Logging that somewhere would allow you to combine this data without to much hassle.

Now, don’t forget to visit De Pastorie yourself! Even if it is only for a drink on their terrace.

Or even better: if you like to receive an actionable optimization report for your site or launch a PPC campaign together to increase traffic: don’t hesitate and send me a message.

FireFox 3.5 Pagerank plugin

The upgrade to the new FireFox 3.5 causes the nice Live Pagerank plugin by Martin of raketforskning to be deactivated.

firefox-pagerank-add-on

Although his URL means “rocket science”, his site seems to be down so I wouldn’t expect an updated version too soon.

Luckily a nice guy named Daniel Olivares has created a new version which runs on FireFox 3.5.

If you own one or more sites the little number that appears in the FireFox status bar is an addiction. The Google Toolbar offers the same, but of course you don’t want the whole package and that’s why this add-on is so popular.

Edit: at the time of writing this new version worked, but it seems like it no longer does. Neither does the one downloadable on the official plugins site (although some users report it does, e.g. with firefox 3.7).

View specific JavaScript with Zend Framework

Because Zend Framework (and in this case also the MVC part) lets you choose how you structure your project, you may have doubted about where to place client-side JavaScript scripts.

icon_javascript

Personally, I place application-wide scripts in something like /media/js/application.js, but in many cases you have scripts that are only applicable to a certain view. Of course we want to avoid having a JavaScript file for each view somewhere in a general JS folder like /media/js.

Putting the JavaScript straight into the view also isn’t optimal since Zend_Layout can for instance put more HTML below it and client-side scripts should be right before the </body> tag.

I thought it would be nice to be able to have [viewname].js files inside the views/[controller] directories. E.g.:

PHP
1
2
3
4
5
6
7
/application
/controllers
BugController.php
/views
/bug
index.phtml
index.js

That makes development easier since your view-specific scripts are still as close to your view as possible, but separated in a .js file so your IDE/editor can parse them as JavaScript. In my case I thought it would also be nice if the .js file would be parsed like the view itself meaning that any variables assigned to the view can also be used in the JavaScript file.

The Zend_Controller_Action postDispatch() method provides a possibility to parse and include the client-side script into the inlineScript view helper where it belongs:

PHP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
public function postDispatch()
{
$request = $this-&gt;getRequest();
$controllerName =  $request-&gt;getControllerName();
$actionName =  $request-&gt;getActionName();
foreach ($this-&gt;view-&gt;getScriptPaths() as $path) {
$fileName = $controllerName . DIRECTORY_SEPARATOR
. $actionName . '.js';
if (file_exists($path . $fileName)) {
$view = clone $this-&gt;view;
$script = $view-&gt;render($fileName);
$this-&gt;view-&gt;inlineScript()-&gt;appendScript($script);
}
}
}

As you can see, the regular view script is cloned so that the same information is passed to the JavaScript file.

The only thing you now need to do is subclass Zend_Controller_Action, paste in the code above and use that new class in your controllers:

PHP
1
class MyController extends My_Controller_Action {}

Happy JavaScripting!

New PDT 2.1 available

Eclipse Galileo

With every new Zend Studio release (still beta) comes a new PDT version: this time based on Eclipse 3.5 Galileo.

While Eclipse Galileo brings some nice new features and bug-fixes (of which many are not important to PHP developers, but nonetheless) PDT actually impresses the most with PHP 5.3 support: syntax coloring and validation with namespaces awareness. More about this in the release notes.

The best news in my opinion: since the software/plugin/update manager of Eclipse underwent some major refactoring, it’s biggest disadvantage may as well disappear! The only sane way to upgrade from 3.4 (or older) to 3.5 is still: delete your old version and unpack the new one, but lets hope this was the last time…

And last but not least: Mylyn integration got even better (I really need to dedicate a post to this).

Be sure to try the new PDT version!

Should I start my own blog?

A question many people and businesses probably have asked themselves at least once.

Earlier this month, Marketingsherpa put up a short post about the answer to that question. They state that you can as easily participate by commenting on other blogs as you can by setting up your own.
While they insinuate that blogging is hard and time consuming, commenting is certainly easier (be sure to set up some kind of profile page to link back too though).

For me however, it has been very satisfying already!

Why do visitors not convert?

Finding out why your visitors do not buy anything or don’t take any other action you want them to take does not need to be that hard.

This post will be an attempt to show how easy it is to get an insight into how many potential “converters” leave your site before they buy anything (or perform any other goal) and why they do this.

Shop

First of all: make sure you set goals in Google Analytics. In this post, I assume you only have one goal, but be sure to mark everything that is of interest to you (as the site owner) as a goal. If you didn’t do this upfront, you’ll have to wait for some time so you have enough data to work with (let’s say at least 150 – 200 conversions).

Secondly: have a look at the people that convert. Because it is a predefined segment, select it like this:

  • Open up the advanced segments selection on the top right of your Google Analytics overview.
  • In the “Default Segments” list, select “Visits with Conversions” and click “Apply”.

As you would expect, you now see information for visitors that completed your goal. One important note: if you have multiple goals, be sure to monitor them separately.

Have a look at the “Visitors” – “Overview” report, you will see some useful averages for visitors that converted. E.g.: you’ll notice people that convert visit at average X number of pages or stay X minutes on your site. Write them down or something (yes, with a good old pencil).

With this information: advanced segmentation to the rescue (again)! It is as easy as this:

  • Open up the advanced segments selection again.
  • Click “Create a new advanced segment”.
  • Add one or more of the averages you have in front of you to the new segment. E.g. Page Depth greater than or equal to 15. As long as you have enough results, segmenting more precise can have advantages (as long as you don’t generalize the outcome).
  • Save the segment and apply it to the reports.

You now basically look over the shoulder of people that leave your site before they convert. You can for instance notice:

  • where they left your site (“Content” – “Top Exit Pages”).
  • whether many of them return more than once (“Visitors” – “New vs. Returning”).
  • if specific countries/languages pop out (“Visitors” – “Map Overlay”/”Languages”).
  • if any OS or browser pops out (“Visitors” – “Browser Capabilities”).
  • whether specific content is notably more popular (“Content” – “Top Content”).

Comparing this to the people that convert can be useful. Did not-converters

  • reach you from a different source (“Traffic Sources” – “All Traffic Sources”)
  • land on another page (“Content” – “Top Landing Pages”)

than converters?

Remember: there really is no end to this – segment and analyze as much as you can. One segment at a time. People in one segment could be leaving for different reasons than people in another.

Don’t hesitate to contact me if you get stuck somewhere!

First impression testing

Gather valuable feedback on your designs, artwork, photos,… by simply waiting. Just waiting. For free.

A nice new web 2.0 application, fivesecondtest, provides a platform for images to be “reviewed” by the public (stored at Amazon S3 of course). It’s dead simple: you upload the image and wait. After some time people will have reviewed your image and marked what drew their attention in the first five seconds they saw your image.

Whether it is a screenshot of your site, a fresh mock-up, a (stock) photograph,… you name it and it gets reviewed. All without creating an account or leaving any personal information.

fivesecondtest

Be sure to review some too!

Edit: use of Calibri font makes it look nice on Windows.

Cleanup – fase 2: move to Google Apps

Google Apps

After getting rid of my Windows Live address, I started to move my domain e-mail to Google Apps (GMail).

Before I moved to Google, my domain e-mail (strictlyphp.com/strictlyphp.be) was handled by my hosting company and I also maintained the e-mail address my ISP provided and the GMail account I checked once in a while.

This has certainly wasted many hours in the past.

Google Apps to the rescue: you create an account, add your domains, point your MX records to Google “et voila”. After everything is set up, you can access your e-mail just like a regular GMail account. This means that you can set up POP3 or IMAP access from within your preferred e-mail client and you can set up your account to fetch messages from external accounts (the ISP account and the regular GMail account I already had in my case).

I had only one difficulty actually: the choice between POP3 and IMAP. I first picked IMAP but I soon realised this was not the optimal choice if you process many messages and maintain many folders. Because it is a synchronization protocol, it is not optimal for offline usage and is of course slower than an offline storage (which is the case for POP3). POP3 on the other hand is not ideal for multiple clients or multiple locations, but you at least don’t need to be connected to search your mailbox.

Because I fetch mail from my laptop, desktop and mobile, the Google Apps mailbox is configured to keep a copy of each message which is unnecessary and can become rather large. There seems to be no solution though: a setup with the setting “leave a copy on server” while fetching e-mail doesn’t work with Google.

Like you may have noticed, you can also not merge your existing regular GMail account with Google Apps and I wouldn’t recommend deleting it either, since the Apps accounts aren’t fully compatible with all Google services which you currently access with your GMail account.

If you doubt about Google Apps in terms of e-mail, maybe the other applications can convince you: Calendar, Mobile, Contacts,… Possible downtime may be the only drawback, but the Premium account (50 USD per year per user) with a 99.9% uptime guarantee provides an answer.