Monthly Archives: October 2010

Why would Google be Traffic Shaping?

There’s an interesting thread over on Webmasterworld about Google Traffic Shaping. It may seem overbaked a bit, but if you know some of the thread participants personally, you’ll realize that if their focus is on it, there’s a good reason.

Secrets abound and on these threads you need to read between the lines a lot or else you’ll be scratching your head.

To summarize the thread, some people have noticed Google tuning their knobs on a site by site basis with respect to traffic that converts. One month traffic may go up while conversions go down…and vice versa.

We all know Google is a data analysis monster. You kind of have to be when your products are “free” and you have to make money through the back door, if you know what I mean.

So how do they make their money? Selling adwords. Lots of them. The more money their advertisers make, the more they’ll advertise. And the more Google will make.

So while they may repeat the mantra that they want to provide the best possible results to the user…as a public corporation, their DUTY is to provide the best possible return on investment to their shareholders.

Therefore, and I say this without emotion or casting aspersions, you have to assume that their dream scenario is a bit different than the PR….

For them, the shopper is the most important Google visitor. Give your customer (ie advertiser), a shopper who converts, and now you have a product with a metric that sounds like music to advertisers.

Imagine if you will, you’re a local shop, independent or outlet of a large chain. You want to pay Google for shoppers and shoppers alone.

So in Google’s ideal world, shoppers will type search terms in Google. All organic results will be of no interest to the shopper and only the paid search results will entice them to click. And once they click, they will convert.

THAT’s why they are experimenting with traffic shaping, particularly in respect to conversions. And they seem pretty far along.

The take home point for webmasters is, to score well online, at least with Google, you need an online presence that converts…and you need to pay Google for that traffic.

I really don’t want any of my friends at Google to be upset by this post. So I’m going to repeat. Google is a public corporation. PR is PR. Business is business. And if Google AREN’T doing this, they would be breaking their fiduciary responsibility. Like in the Godfather, everyone needs to put bread on the table. It’s not personal.

Running PHPUnit + Zend Framework in different environments

One thing that I haven’t seen any of the tutorials cover is how to handle running PHPUnit in different environments. Most people are just setting a new APPLICATION_ENV called ‘testing’, put a section in application.ini called ‘testing’ as well, and leave it at that….

What I’ve found, is that I’m using various things that will change in different environments.

For example, on local I just create a shortcut domain in my hosts file so I can easily play. So if I’m building a site for someverylongexample.com, I just make x.com my localhost. Which works great for me. See, I’m lazy.

Then some clients like to have a different domain for staging so they can point to different databases, or whatever reason.

And then you may just want to run a few tests with an environment of ‘production’ or ‘development’. For example, I only log to firebug on local or dev.

Frustrated, I just modified the usual settings you see.

Before going any further, make sure you check out a basic tutorial on Zend Framework and PHPUnit. For example:
http://weierophinney.net/matthew/archives/190-Setting-up-your-Zend_Test-test-suites.html
or
http://www.zendcasts.com/unit-testing-with-the-zend-framework-with-zend_test-and-phpunit/2009/06/

Done?
Good.

So here’s how I modified the files to cover these requirements.

1. instead of running phpunit off of phpunit.xml, I renamed that file phpunit_local.xml.

So on the command line, you’ll run this:
phpunit –configuration phpunit_local.xml

The contents of that file are (I’ve had it w/ WordPress messing up my formatting. Why do they have a CODE tag if it doesn’t handle much of anything very well? I’m going to put this on pastie.org and pastebin.com & hopefully one of them will survive as long as this post stays relevant):

Pastie

or

Pastebin

2. You probably noticed that instead of pointing to the bootstrap.php file, I renamed it bootstrap_local.php.

Here are the contents:

Pastie

OR

Pastebin

3. I wanted to be able to override the APPLICATION_ENV to test production/dev/local from time to time. So I modified the ControllerTestCase.php as follows:

Pastie

OR

Pastebin

Now you can test whatever environment you want by just overriding _setAppEnv().

This way, when you switch to prod, you’ll have a robust test to run that things work in the new environment. This happens to be one of the most important aspects of Unit Tests that no one seems to speak about. You usually have a slightly different environment and it can break things. If you’re only running your unit tests on local, you’re really missing one of the key benefits of all this effort.

If you think I’m way off, or have ideas on improving this code, leave a comment or ping me on twitter.

P.S. I just took a look at Matthew’s post on Zend_Test, which I had just found through a Google search, and noticed he uses a TestHelper.php. You can certainly do something very similar with the TestHelper…which is analogous to the bootstrap.php file I was using.

2nd Update: Forgot to mention, obviously you can’t redefine constants, so you may just have a subset you want to test. I’m assuming that you’re organizing things with the wonderful @group functions of PHPUnit and that you run this intelligently.

Popular OpenID endpoints

I couldn’t find a nice list of popular OpenID endpoints, so I’m starting one. Help me improve it with corrections, additions. Just ping me.

Gmail:
https://www.google.com/accounts/o8/id
Only issue is per domain key.

Google Profiles:
http://www.google.com/profiles/~username
Unfortunately, user must enter username. And most people don’t have one.

Yahoo:
https://me.yahoo.com
Some of their docs state that you can just use the Yahoo domain. Not really true. You may get it to work, but it’s buggy and not guaranteed to stay available.

AOL:
https://www.aol.com/
(Thanks George Fletcher)

Microsoft/Windows Live:
I’ve heard different things: They support it. They don’t. They are beta testing it. They removed it.

Stack Overflow doesn’t have an icon for them.
JanRain DOES though.

Not sure if they have special permission or not.
Maybe if you use firebug or the URL Janrain takes you to, you can suss it out.

Facebook:
They’ve got some excellent tools for logging in. They also accept Oauth. Arguably the simplest implementation although Twitter and LinkedIn have come out w/ similar stuff now. Alas, as far as I can tell, no OpenID endpoint.

Twitter:
Hmm. I thought that they accepted OpenID. It looks like Oauth and their javascript implementation is it. Can’t find their OpenID endpoint.

LinkedIn:
I thought I saw something about LinkedIn supporting OpenID, but can’t find the endpoint. Ping me if you know it. I do have their Oauth support working though and they just improved it yesterday.

WordPress:
http://yourblog.wordpress.com

Livejournal:
http://www.livejournal.com/openid/server.bml
(untested)

Chi.mp
http://chi.mp/
(Tx Brian)

Note: I’m not going to personally add an endpoint for every small company that a user is very unlikely to use as their openid, so please don’t ping me to SEO your company. IOW, if you don’t have 100 million users, you aren’t likely to make the list (unless your entire business revolves around OpenID, like ClaimID for example).