Archive for September, 2011

The 21 Greatest SEO Myths of the Modern World


  

They say that ignorance is bliss and knowledge is power but somewhere between these clichés there’s a spot reserved for individuals who possess a little too much knowledge to be blissful but still only enough knowledge to be dangerous.

SEO, as an industry, is known unfortunately for the mass of rumours, myths, mistruths and unscrupulous gurus. This in part stems from the search engines’ unwillingness to discuss their algorithms (this lack of disclosure is completely understandable). This breeds a culture of myths where newbies and veterans alike get caught out by nothing more than hearsay that gains traction.

The aim of this post is to try and dispel some of the more widely held SEO myths:

#1 – Google is the Only Search Engine


Google may be the largest search engine but you shouldn’t ignore the others. Image Credit

It sounds ridiculous to say and whilst Google is the biggest of the search engines, Bing has certainly cornered a fair percentage of the market – some say as high as 30% of all US searches are powered by Bing. This means that while you should undoubtedly concentrate your SEO efforts on pandering to Google, you shouldn’t completely ignore Bing.

Many of the techniques and principles are the same across the search engines but you should also do things like register your website over at Bing’s Webmaster Center Tools.

#2 – You Need to Submit Your Website to Google

This is a myth that has been around as long as Alta Vista.

There are hundreds if not thousands of hosting companies, SEO companies and web designers offering to ‘submit’ your website to all the major search engines – and charge you for the privilege.

The fact is you just don’t need to submit your website to Google or any other search engine. Inclusion in search engines is free and usually automated. Google very often finds and indexes your website as a result of visiting a link contained on another web page.

#3 – You Can ‘SEO’ a Website Just Once

Search engine optimisation is rarely a one-time thing – we understand why people hope it is, since cash, particularly in small businesses, is precious. However, a website’s search engine performance needs regular attention.

This might sound like the plea of a salesman pitching a monthly retainer but the simple fact of the matter is that Google et al tweak their algorithms and search results constantly, not forgetting the fact that your competitors are likely to be investing in improving their websites too.

All of this can have a dramatic impact on your website’s performance in the search results. If you’re not investing in SEO on a regular basis then you’re falling behind.

#4 – You don’t need to worry about SEO

There are some people who will tell you to completely disregard SEO, saying that they’ve never given a fig about the search engines in their life and they’ve done alright.

Granted, some brands, rockstars and superstar bloggers can get away with not bothering. For everyone else however, optimising your website and working towards better search engine visibility is essential. Whilst you shouldn’t do things or make decisions solely on the basis of search engines, you should certainly contemplate them and understand how they work and what they look for because they are a truly astounding source of traffic.

#5 – Your Rankings Don’t Matter

The advent of personalised search results has reduced the importance of rankings somewhat but they aren’t obsolete by any means. They may not give you a 100% accurate picture but they are a fair indication or approximation of where your website ranks for the majority of users.

We understand why this myth came to be, and we accept that any SEO worth their salt should be focusing their attention on more than just rankings these days; overall search visibility, conversion rate and search engine traffic are core success metrics in many’s eyes.

But don’t forget that the lion-share of searchers will leave Google via the first page of results so knowing where your website sits is a very useful indicator indeed.

#6 – An XML Sitemap Will Boost Your Rankings

We imagine this started life as the perfectly legitimate advice that having a sitemap is a good idea from an SEO perspective – it certainly is a best practice.

However, whispers across forums and blogs likely transformed this into the myth that a sitemap would boost your rankings. The suggestion that a sitemap will give any page on your website a boost is pure fiction – search engines use your sitemap to learn about the structure of your site and to increase coverage of your webpages.

#7 – Keyword Domains Trump All Other Tactics


Keyword domains don’t hold the same power as they once did. In fact, the idea is somewhat dated. Image Credit

In case you are wondering, a keyword domain is a domain that includes a keyword you wish to target, for example cheapwidgets.com.

Registering a keyword domain was, at one time, a reasonable SEO strategy (not one that we favoured, but nobody can deny that it worked) however since Matt Cutts announced in 2010 that Google would be looking into why keyword domains rank so well and the search engine’s subsequent ‘tuning down’ of the power of keyword domains, this has become a far less effective strategy.

We will accept that in some markets it will still work but this isn’t going to be the case for very long since in most verticals and particularly on competitive keywords, Google has all but wiped out the keyword domains that didn’t really deserve the rankings they had suggesting they’ve gotten wise to the tactic.

If you’re looking to establish a solid foundation for your website then it is far smarter to opt for a brandable and memorable domain rather than attempting to shoehorn your target keywords into a long, often hyphenated, difficult to remember and spammy looking domain.

To be clear, if you own a keyword domain, it’s not going to count against you, you just need to embark on a proper promotional campaign including link development and social media marketing in order to build the authority and profile of the website.

#8 – Copying a Competitor = A Strategy

There is a widely held belief that firing up OpenSiteExplorer and taking a look under the hood of your competitor’s website constitutes an SEO strategy – it really doesn’t.

Replicating your competitor’s link profile or search strategy is rarely a smart move and may even count against you. This is because a technique or linking method that works for them may not work the same way for you.

There’s nothing wrong with learning from your competitors, as the old saying goes “Learn from the mistakes that other people make� and with the wealth of data available, it is a smart move to understand what your competition is doing and develop your strategy accordingly.

#9 – Meta Data is Worthless

Less important, yes. But worthless? No.

We’ve seen Google ignore meta titles and descriptions when it thinks there is a better one to use but by and large it will take your hint as to what the page is about.

Wouldn’t you much rather your preferred title and description were used rather than what Google can pull from the page itself? Meta data is your chance to convince searchers to clickthrough – it is your platform to engage and standout.

With the launch of Google+, each time a link is published on the social network, a title and description is scraped. If your website doesn’t have any data then Google will pull in whatever it can find, and your link could end up looking pretty ugly.

#10 – You Can Learn SEO by Reading Up

In every industry there are ‘gurus’ and the world of SEO is no different – wannabe experts who’ve got their website ranking for a brand term and suddenly think they’re qualified to teach others “how to get page 1 rankings�.

There are some gurus out there who spend more time theorising, pontificating and regurgitating opinions of others than they do actually SEOing, consequently their knowledge and advice often leaves a little to be desired.

Be careful who you take advice from and try to divide your time 10/90 so for every 10 minutes you spend studying SEO you should spend 90 minutes actually doing it. The best way to learn SEO is to experiment yourself.

That’s not to say that there aren’t some sharp minds out there, in fact there are many SEO blogs out there worth checking out.

With Google’s recent announcement that they will support the rel author attribute, trust and authority will start to play a bigger role in SEO in the future. This should help to increase the visibility of the true experts out there – which will be a good thing for everyone.

#11 – Google Adwords Can Hurt/Help Your Rankings

There is a definite conspiracy theory that advertising via the Google Adwords platform somehow impacts on your organic search rankings. There seems to be just as many people who believe the exact opposite. That fact alone should tell you that there is absolutely no truth to this.

Nevertheless, it is a myth that continues to spread despite the fact that Google has reiterated time and time again that “Google’s advertising programs are entirely independent of the unpaid search results.â€� (source)

It is understandable why some people believe this to be a fact but in reality having worked on close to 250 campaigns (which included a mix of SEO and PPC), honestly, there is no visible correlation whatsoever between Google Adwords spending and organic rankings.

#12 – Google Will Never Figure Out What I’m Up To


Be very mindful of the footprint you are leaving… Image Credit

Google is very advanced – there are undoubtedly some areas they could improve on – but by and large as each year passes their algorithm gets smarter and smarter in order to deliver better and better results for users.

Find the balance; develop a strategy that gets the results you want without pushing it too far and earning yourself a penalty or worse still a ban.

Google is very quick to recognize patterns in linkbuilding for example; if they detect anything unnatural or untoward then you could be in for a nasty shock.

With the recent Panda update, Google has also advanced a great deal in the way it views content; it has certainly gotten better at identifying duplicate and thin content. One could even argue that Google, is now very close to ‘understanding’ what makes content high-quality, making the need to be an authority and true expert in your market an ever increasing necessity.

Be mindful of the footprint you are leaving – build for the long term where possible and if you are going to dabble in the edgier tactics then make sure you know what you’re doing.

#13 – Scraping is a Content Strategy

Despite all the recent Panda update noise in the online marketing world, there are still some webmasters out there that are scraping content.

If you don’t know what scraping content is then in essence it is a process whereby content is pinched from a website and republished on another.

Filling your website with other people’s unique content does not constitute a strategy; it will get your website flagged for spam probably faster than any other tactic.

We readily accept that sometimes scraped content outranks the original but this occurs more and more infrequently. To see scraping as a viable content creation technique is unethical, often illegal and just plain crazy.

Google and Bing actively encourage creating high-quality content and since the good stuff tends to be what attracts and engages real people then common sense tells us it will always be the best strategy.

#14 – Keyword Density Rules

We simply had to include this one. Despite this myth repeatedly being buried, keyword density always seems to find its way into the conscious minds of newbies and intermediates alike.

Back in the early days of search engines, there was a magical keyword density percentage that each page should fulfil in order to rank well. If things weren’t going well, you’d just add more keywords, simple.

The effectiveness of this technique died out a long time ago and yet we still see websites trying desperately hard to jump through a hoop that doesn’t exist.

Write for humans whilst interweaving keywords naturally into your text. Saturating your copy with keywords is a shortcut to switched-off visitors.

#15 – You Should Crank Out as Much Content as Possible


Creating content, unlike working on the factory floor, is not about sheer output quantity. Image Credit

There was a time where churning as much content out as possible was an arguably effective strategy. Want to target a new keyword? Just create a new page, rehash the text from a closely related page and Bob’s your uncle; you’ve got some extra-long tail search traffic.

However, since Google rolled out their Panda update (which they’ve labeled a high-quality sites algorithm) they issued some guidance as to what they expect high-quality might look like.

They published some questions that help you to better understand Google’s mindset when they set out the aims of the Panda update. One of these questions was:
“Does the site have duplicate, overlapping, or redundant articles on the same or similar topics with slightly different keyword variations?�

This is a direct attack on the aforementioned strategy and gives you all the more reason to consolidate your unruly content archive into a neatly organised, engaging and informative series of knowledge hubs – your visitors will love you for it too.

Publish content that adds value for the end user rather than content designed solely to feed search engine spiders – the spiders have lost their appetite for junk.

#16 – There’s an Ideal Wordcount

We can’t say for sure the actual origins of this myth but the truth is that there really isn’t a wordcount requirement for SEO.

If you produce a piece that is too short then you run the risk of not covering the topic in enough detail which can be a turn off for the people reading it and can also be a turn off for the search engines.

If you produce a piece that is too long then you run the risk of it being perceived as boring or un-readable which will have a negative impact on the social/viral capabilities of the piece – which could have a knock-on effect to your rankings. A long and boring piece of content may also prove a complete turn-off to visitors who immediately leave your website; this ‘bounceback effect’ will impact on user data which Google then reworks back into how it ranks your website.

The answer is that you should produce content that is just right – no need to worry about how many words it is, just cover what needs to be covered, edit and proofread it then publish it in a user-friendly format.

#17 – It’s All About Great Content

We truly wish we could tell you that Google and Bing were smart enough to recognise great content alone –we could all build fantastic websites and people would flock to our doors to devour our content.

Sadly, we’re not quite there yet and whilst high-quality content is a big (and ever-growing) part of SEO, it isn’t the whole shebang. You’ll still need to get involved in other areas if you are going to succeed in the search results.

Having an attention strategy for your website and content is paramount to SEO – without it, any time or resources invested in content will potentially be wasted.

#18 – PageRank is the Only Metric That Matters

Google has long been telling us not to obsess over PageRank (PR) and yet many continue to do so. It just isn’t the metric it once was.

Sure, it is interesting as a concept to understand and it’s interesting to know the published PageRank (See myth #19) of your own website but don’t judge everything you do by PR.

There are over 200 ranking factors that Google uses to determine where your website appears in the search results, PageRank is one of them and is therefore only a very small part of your website’s performance.

When it comes to building links, it can be easy to get drunk on the PageRank as you seek out ‘high-PR’ websites to attain links from but remember that there is more to a link than its PageRank; think traffic, neighbourhood, context, type and position to name but a few link quality metrics.

#19 – Toolbar PageRank and PageRank Are the Same Thing

To many, PageRank is PageRank but in actual fact it has long been accepted that there is a published PageRank, often referred to as toolbar PageRank, and an internal PageRank which Google uses behind closed doors and doesn’t actually publish.

Toolbar PageRank, inherited the name because of its appearance in the Google toolbar, is actually a snapshot of internal PageRank data so is very often out of date since it is only updated intermittently throughout the year.

This added confusion helps to reinforce the point that you shouldn’t ever see PageRank as the king of all metrics.

#20 – Quantity of Links is What Matters


Building links isn’t just a numbers game, it’s a metrics game – relevance and quality are more important. Image Credit

This myth stems from the principle that a link was a vote for your website and therefore the more votes (links) your website got; the more popular it must be and therefore should rank higher.

Sadly, not all links are created equal.

We can see why some people are quantity obsessed when it comes to links because as consumers we have been brainwashed to assess value by volume; big household brands have drummed into us that more = better. However when it comes to building links, it’s the quality that counts.

#21 – No-follow = Not Worth It

The no-follow attribute provides a way for webmasters to tell search engines not to follow any links on a page or a specific link on that page.

It tells the search engines that you don’t editorially vouch for the website you are linking out to and therefore no anchor text, PageRank or any of your website’s authority should be passed on. No-follow is in essence contraception for links.

This has led to the widely held belief that a link that is no-follow is not valuable. In my opinion, links that are no-follow are still valuable for two reasons:

Many leading websites no-follow their links but the traffic and exposure opportunities alone still make the link worthwhile.

Furthermore, it wouldn’t be unreasonable to assume that search engines assess how natural your link profile looks and since generally speaking a website will pick up some no-follow links naturally, it would look wholly suspicious if your link profile consists only of do-follow links. (See myth #12)

The fact is that search engines and their algorithms evolve all the time but the fundamental principles remain almost the same – create a high quality website that delights, engages and provides value to an audience whether that be your readers or your customers.

That is All

So that does it for this myth-busting look at the world of SEO. What SEO myths have you heard that were not discussed? Which of the myth-busting dissections do you disagree with? Have you fallen victim to any of these myths before? Hit us up in the comments and let us know!

(rb)


WordPress Essentials: Interacting With The WordPress Database





 



 


While you already use many functions in WordPress to communicate with the database, there is an easy and safe way to do this directly, using the $wpdb class. Built on the great ezSQL class by Justin Vincent, $wpdb enables you to address queries to any table in your database, and it also helps you handle the returned data. Because this functionality is built into WordPress, there is no need to open a separate database connection (in which case, you would be duplicating code), and there is no need to perform hacks such as modifying a result set after it has been queried.

$wpdb class
The $wpdb class modularizes and automates a lot of database-related tasks.

In this article, I will show you how to get started with the $wpdb class, how to retrieve data from your WordPress database and how to run more advanced queries that update or delete something in the database. The techniques here will remove some of the constraints that you run into with functions such as get_posts() and wp_list_categories(), allowing you to tailor queries to your particular needs. This method can also make your website more efficient by getting only the data that you need — nothing more, nothing less.

Getting Started

If you know how MySQL or similar languages work, then you will be right at home with this class, and you will need to keep only a small number of function names in mind. The basic usage of this class can be best understood through an example, so let’s query our database for the IDs and titles of the four most recent posts, ordered by comment count (in descending order).

<?php
   $posts = $wpdb->get_results("SELECT ID, post_title FROM wp_posts WHERE post_status = 'publish'
   AND post_type='post' ORDER BY comment_count DESC LIMIT 0,4")
?>

As you can see, this is a basic SQL query, with some PHP wrapped around it. The $wpdb class contains a method (a method is a special name for functions that are inside classes), named get_results(), which will not only fetch your results but put them in a convenient object. You might have noticed that, instead of using wp_posts for the table’s name, I have used $wpdb->posts, which is a helper to access your core WordPress tables. More on why to use these later.

The $results object now contains your data in the following format:

Array
(
   [0] => stdClass Object
      (
         [ID] => 6
         [post_title] => The Male Angler Fish Gets Completely Screwed
      )

   [1] => stdClass Object
      (
         [ID] => 25
         [post_title] => 10 Truly Amazing Icon Sets From Germany
      )

   [2] => stdClass Object
      (
         [ID] => 37
         [post_title] => Elderberry Is Awesome
      )

   [3] => stdClass Object
      (
         [ID] => 60
         [post_title] => Gathering Resources and Inspiration With Evernote
      )

)

Retrieving Results From The Database

If you want to retrieve some information from the database, you can use one of four helper functions to structure the data.

get_results()

This is the function that we looked at earlier. It is best for when you need two-dimensional data (multiple rows and columns). It converts the data into an array that contains separate objects for each row.

<?php
   $posts = $wpdb->get_results("SELECT ID, post_title FROM wp_posts WHERE post_status = 'future'
   AND post_type='post' ORDER BY post_date ASC LIMIT 0,4")

   // Echo the title of the first scheduled post
   echo $posts[0]->post_title;
?>

get_row

When you need to find only one particular row in the database (for example, the post with the most comments), you can use get_row(). It pulls the data into a one-dimensional object.

<?php
   $posts = $wpdb->get_row("SELECT ID, post_title FROM wp_posts WHERE post_status = 'publish'
   AND post_type='post' ORDER BY comment_count DESC LIMIT 0,1")

   // Echo the title of the most commented post
   echo $posts->post_title;
?>

get_col

This method is much the same as get_row(), but instead of grabbing a single row of results, it gets a single column. This is helpful if you would like to retrieve the IDs of only the top 10 most commented posts. Like get_row(), it stores your results in a one-dimensional object.

<?php
   $posts = $wpdb->get_col("SELECT ID FROM wp_posts WHERE post_status = 'publish'
   AND post_type='post' ORDER BY comment_count DESC LIMIT 0,10")

   // Echo the ID of the 4th most commented post
   echo $posts[3]->ID;
?>

get_var

In many cases, you will need only one value from the database; for example, the email address of one of your users. In this case, you can use get_var to retrieve it as a simple value. The value’s data type will be the same as its type in the database (i.e. integers will be integers, strings will be strings).

<?php
   $email = $wpdb->get_var("SELECT user_email FROM wp_users WHERE user_login = 'danielpataki' ")

   // Echo the user's email address
   echo $email;
?>

Inserting Into The Database

To perform an insert, we can use the insert method:

$wpdb->insert( $table, $data, $format);

This method takes three arguments. The first specifies the name of the table into which you are inserting the data. The second argument is an array that contains the columns and their respective values, as key-value pairs. The third parameter specifies the data type of your values, in the order you have given them. Here’s an example:

<?php
   $wpdb->insert($wpdb->usermeta, array("user_id" => 1, "meta_key" => "awesome_factor", "meta_value" => 10), array("%d", %s", "%d"));

   // Equivalent to:
   // INSERT INTO wp_usermeta (user_id, meta_key, meta_value) VALUES (1, "awesome_factor", 10);
?>

If you’re used to writing out your inserts, this may seem unwieldy at first, but it actually gives you a lot of flexibility because it uses arrays as inputs.

Specifying the format is optional; all values are treated as strings by default, but including this in the method is a good practice. The three values you can use are %s for strings, %d for decimal numbers and %f for floats.

Updating Your Data

By now, you won’t be surprised to hear that we also have a helper method to update our data — shockingly, called update(). Its use resembles what we saw above; but to handle the where clause of our update, it needs two extra parameters.

$wpdb->update( $table, $data, $where, $format = null, $where_format = null );

The $table, $data and $format parameters should be familiar to you; they are the same as before. Using the $where parameter, we can specify the conditions of the update. It should be an array in the form of column-value pairs. If you specify multiple parameters, then they will be joined with AND logic. The $where_format is just like $format: it specifies the format of the values in the $where parameter.

$wpdb->update( $wpdb->posts, array("post_title" => "Modified Post Title"), array("ID" => 5), array("%s"), array("%d") );

Other Queries

While the helpers above are great, sometimes performing different or more complex queries than the helpers allow is necessary. If you need to perform an update with a complex where clause containing multiple AND/OR logic, then you won’t be able to use the update() method. If you wanted to do something like delete a row or set a connection character set, then you would need to use the “general� query() method, which let’s you perform any sort of query.

$wpdb->query("DELETE FROM wp_usermeta WHERE meta_key = 'first_login' OR meta_key = 'security_key' ");

Protection And Validation

I hope I don’t have to tell you how important it is to make sure that your data is safe and that your database can’t be tampered with! Data validation is a bit beyond the scope of this article, but do take a look at what the WordPress Codex has to say about “Data Validation� at some point.

In addition to validating, you will need to escape all queries. Even if you are not familiar with SQL injection attacks, still use this method and then read up on it later, because it is critical.

The good news is that if you use any of the helper functions, then you don’t need to do anything: the query is escaped for you. If you use the query() method, however, you will need to escape manually, using the prepare() method.

$sql = $wpdb->prepare( 'query' [, value_parameter, value_parameter ... ] );

To make this a bit more digestible, let’s rewrite this basic format a bit.

$sql = $wpdb->prepare( "INSERT INTO $wpdb->postmeta (post_id, meta_key, meta_value ) VALUES ( %d, %s, %d )", 3342, 'post_views', 2290 )
$wpdb->query($sql);

As you can see, this is not that scary. Instead of adding the actual values where you usually would, you enter the type of data, and then you add the actual data as subsequent parameters.

Class Variables And Other Methods

Apart from these excellent methods, there are quite a few other functions and variables to make your life easier. I’ll show you some of the most common ones, but please do look at the WordPress Codex page linked to above for a full list of everything that $wpdb has to offer.

insert_id()

Whenever you insert something into a table, you will very likely have an auto-incrementing ID in there. To find the value of the most recent insert performed by your script, you can use $wpdb->insert_id.

$sql = $wpdb->prepare( "INSERT INTO $wpdb->postmeta (post_id, meta_key, meta_value ) VALUES ( %d, %s, %d )", 3342, 'post_views', 2290 )
   $wpdb->query($sql);

   $meta_id = $wpdb->insert_id;

num_rows()

If you’ve performed a query in your script, then this variable will return the number of results of your last query. This is great for post counts, comment counts and so on.

Table Names

All the core table names are stored in variables whose names are exactly the same as their core table equivalent. The name of your posts table (probably wp_posts) would be stored in the $posts variable, so you could output it by using $wpdb->posts.

We use this because we are allowed to choose a prefix for our WordPress tables. While most people use the default wp, some users want or need a custom one. For the sake of flexibility, this prefix is not hardcoded, so if you are writing a plug-in and use wp_postmeta in a query instead of $wpdb->postmeta, your code will not work on some websites.

If you want to get data from a non-core WordPress table, no special variable will be available for it. In this case, you can just write the table’s name as usual.

Error Handling

By calling the show_errors() or hide_errors() methods, you can turn error-reporting on or off (it’s off by default) to get some more info about what’s going on. Either way, you can also use the print_error() method to print the errors for the latest query.

$wpdb->show_errors();
   $wpdb->query("DELETE FROM wp_posts WHERE post_id = 554 ");

   // When run, because show_errors() is set, the error message will tell you that the "post_id" field is an unknown
   // field in this table (since the correct field is ID)

Building Some Basic Tracking With Our New $wpdb Knowledge

If you’re new to all of this, you probably get what I’m going on about but may be finding it hard to implement. So, let’s take the example of a simple WordPress tracking plug-in that I made for a website.

For simplicity’s sake, I won’t describe every detail of the plug-in. I’ll just show the database’s structure and some queries.

Our Table’s Structure

To keep track of ad clicks and impressions, I created a table; let’s call it “tracking.� This table records user actions in real time. Each impression and click is recorded in its own row in the following structure:

  • ID
    The auto-incremented ID.
  • time
    The date and time that the action occurred.
  • deal_id
    The ID of the deal that is connected to the action (i.e. the ad that was clicked or viewed).
  • action
    The type of action (i.e. click or impression).
  • action_url
    The page on which the action was initiated.
  • user_id
    If the user is logged in, their ID.
  • user_ip
    The IP of the user, used to weed out any naughty business.

This table will get pretty big pretty fast, so it is aggregated into daily statistics and flushed periodically. But let’s just work with this one table for now.

Inserting Data Into Our Tables

When a user clicks an ad, it is detected, and the information that we need is sent to our script in the form of a $_POST array, with the following data:

Array
(
   [deal_id] => 643
   [action] => click
   [action_url] => http://thisiswhereitwasclicked.com/about/
   [user_id] => 223
   [user_ip] = 123.234.223.12
)

We can then insert this data into the database using our helper method, like so:

$wpdb->insert('tracking', array("deal_id" => 643, "action" => "click", "action_url" => "http://thisiswhereitwasclicked.com/about/",
"user_id" => 223, "user_ip" => "123.234.223.12"), array("%d", %s", "%s", "%d", "%s"));

At the risk of going on a tangent, I’ll address some questions you might have about this particular example. You may be thinking, what about data validation? The click could have come from a website administrator, or a user could have clicked twice by mistake, or a bunch of other things might have happened.

We decided that because we don’t need real-time stats (daily stats is enough), there is no point to check the data at every insert. Data is aggregated into a new table every day around midnight, a low traffic time. Before aggregating the data, we take care to clean it up, taking out duplicates and so on. The data is, of course, escaped before being inserted into the table, because we are using a helper function; so, we are safe there.

Just deleting in bulk all at once the ones that are made by administrators is easier than checking at every insert. This takes a considerable amount of processing off our server’s shoulders.

Deleting Actions From a Blacklisted IP

If we find that the IP address 168.211.23.43 is being naughty-naughty, we could blacklist it. In this case, when we aggregate the daily data, we would need to delete all of the entries by this IP.

$sql = $wpdb->prepare("DELETE FROM tracking WHERE user_ip = %s ", '168.211.23.43');
   $wpdb->query($sql);

You have probably noticed that I am still escaping the data, even though the IP was received from a secure source. I would suggest escaping your data no matter what. First of all, proper hackers are good at what they do, because they are excellent programmers and can outsmart you in ways that you wouldn’t think of. Also, I personally have done more to hurt my own websites than hackers have, so I do these things as a safety precaution against myself as well.

Updating Totals

We store our ads as custom post types; and to make statistical reporting easier, we store the total amount of clicks that an ad receives separately as well. We could just add up all of the clicks in our tracking database for the given deal as well, so let’s look at that first.

$total = $wpdb->get_var("SELECT COUNT(ID) WHERE deal_id = 125 ");

Because getting a single variable is easier than always burdening ourselves with a more complex query, whenever we aggregate our data, we would store the current total separately. Our ads are stored as posts with a custom post type, so a logical place to store this total is in the postmeta table. Let’s use the total_clicks meta key to store this data.

$wpdb->update( $wpdb->postmeta, array("meta_value" => $total), array("ID" => 125), array("%d"), array("%d") );

   // note that this should be done with update_post_meta(), I just did it the way I did for example's sake

Final Thoughts And Tips

I hope you have gained a better understanding of the WordPress $wpdb class and that you will be able to use it to make your projects better. To wrap up, here are some final tips and tricks for using this class effectively.

  • I urge you to be cautious: with great power comes great responsibility. Make sure to escape your data and to validate it, because improper use of this class is probably a leading cause of hacked websites!
  • Ask only for the data that you need. If you will only be displaying an article’s title, there is no need to retrieve all of the data from each row. In this case, just ask for the title and the ID: SELECT title, ID FROM wp_posts ORDER BY post_date DESC LIMIT 0,5.
  • While you can use the query() method for any query, using the helper methods (insert, update, get_row, etc.) is better if possible. They are more modular and safer, because they escape your data automatically.
  • Take care when deleting records from a WordPress (or any other) database. When WordPress deletes a comment, a bunch of other actions also take place: the comment count in the wp_posts table needs to be reduced by one, all of the data in the comment_meta table needs to be deleted as well, and so on. Make sure to clean up properly after yourself, especially when deleting things.
  • Look at all of the class variables and other bits of information in the official documentation. These will help you use the class to its full potential. I also recommend looking at the ezSQL class for general use in your non-WordPress projects; I use it almost exclusively for everything I do.

Further Reading

(al)


© Daniel Pataki for Smashing Magazine, 2011.


Are You Ready For A Web Design Challenge?





 



 


This is not a normal Smashing Magazine post. I’m not going to teach you something new or inspire you with examples of great work. Instead, I want to encourage you to complete a Web design challenge. I believe this will help to address a weakness that exists in many of our design processes.

If you complete this challenge, it will make it easier for clients to sign off on your designs, and it will improve the quality of your work.

So, what are we waiting for? Let’s get started.

The Challenge

If you’re like me, you did some form of higher education in art and design and will know about “the crit.� These meetings involve the class coming together with tutors to analyze and provide constructive criticism on each other’s work.

These were terrifying meetings in which I justified my design approach and defended it against criticism. Although I hated every minute of them, I believe they nurtured one of the most useful skills I have as a Web designer.

The ability to logically justify our designs is a skill many of us lack. This is the heart of the challenge I wish to lay down.

My challenges is this:

Write a blog post justifying the design approach you took to one of your websites. Then, encourage other Web designers to provide feedback and ask questions.

Admittedly, this might sound like a lot of effort, so let me explain why it is worth your while.

Why This Challenge Is Worth Undertaking

As I said in a previous article, being a great designer is not enough. You can produce outstanding work and be the envy of your peers, and yet struggle to convince clients of your approach. The reason is that clients do not understand design the way your colleagues do. Therefore, you need to be able to articulate what makes your design right.

Our ability to justify our choices is crucial to our relationship with clients. Without it, clients will lack confidence in our abilities or, worse, feel excluded from the process. A lack of confidence leads to micro-management, and exclusion leads to frustration and resentment. Therefore, explaining our approach is vital.

However, it isn’t just about the client. It’s also about your personal development. If you don’t have a clear idea of what works, then improving will be difficult. Design critiques are as much about improving the quality of your work as justifying it to others.

Unfortunately, this requires that we overcome two barriers.

First, many of us don’t fully understand why we have designed a website a certain way. We design at a subconscious level, based on years of experience. When you have been driving for a while, you cease to think about the process of driving. Likewise, design decisions are often handled at a deeper level than the conscious mind.

Secondly, many designers haven’t had to justify their approach in the past. Either they haven’t gone through the rigorous critiques that I experienced in university or they don’t have the experience required to articulate their decisions.

It is for these reasons that this challenge is so valuable. By writing a blog post about a particular design and encouraging feedback, you move your decisions from the subconscious to the conscious level and gain valuable experience in articulating them.

Of course, knowing where to start such a challenge can be a challenge in itself.

Where To Start

If you are not used to thinking about design at a conscious level, then you might struggle to begin. While there is no right way to do this, I can share the approach that I use.

When discussing my design with others, I tend to look at the various components that make up the product. These usually are:

  • Grid,
  • Layout,
  • Color,
  • Typography,
  • Imagery,
  • Styling.

Ask yourself, why did you approach each of these elements the way that you did? Let’s consider each in turn.

Grid

Why did you use that particular grid structure on the website you are reviewing? Can you articulate your reasons for using a 12-column grid instead of a 16-column one? What about the margins and padding? If a client complained that there was too much white space between columns, would you have a response?

Another common issue is when you purposely break out of a grid. Was the choice intentional, with good reasoning, or just an impulsive decision? What would you say if the client asked about it?

The choice of grid might be based on the content or on the constraints of the style guide. It could have to do with making the website work on mobile devices or with allowing flexibility for future changes. Whatever the reason, you need to be able to clearly articulate them to yourself and the client.

960 Grid System
Are we selecting a particular grid because it is right for the website or just because we have fallen into the habit? We need to be able to justify our approach to our clients and ourselves.

Layout

Layout and grid might sound the same, but they’re not. By layout, I am referring to white space and the placement of elements on the page. These are often points of conflict between the designer and client, so being able to explain your approach is important. For example, how would you justify all of the white space that Google has chosen to use on its home page?

Why did you leave so much white space on the page? Was it to draw the user’s eye to a particular element, or perhaps to improve readability?

What about the positioning of elements? Why is the search box in the top-right corner? Is it because this is the convention and people look for it there, or perhaps because you wanted to associate it with other elements that are in proximity?

Color

Color is probably the most controversial of subjects, and so we need to understand our motivation. I tend to approach color selection in one of four ways:

  1. Corporate branding guidelines
    The palette has been defined by the guidelines, and I work within these constraints.
  2. Theory
    I use a tool such as Kuler, which produces a palette based on established theory.
  3. Emotional response
    The extensive research done on people’s responses to colors informs my palette.
  4. Main image
    If the website has a dominant image that has already been approved by the client, I use it as the basis for the color palette. There are great tools for extracting color palettes from images.

Adobe Kuler
Adobe Kuler is just one of many tools that help you apply color theory to your palette selection.

By explaining your choices in these objective terms, you prevent color from becoming a matter of personal preference and thus avoid conflict.

Typography

Something as seemingly simple as typography consists of many different decisions. These decisions extend far beyond the selection of typeface and encompass line height, size, weight, kerning and much more.

Fontdeck.com
With services like Fontdeck making so many fonts available to us, the need to understand and justify our choices is more important than ever.

You need to be able to speak confidently about your choices if you are to demonstrate your expertise and convey that what you do is a lot more complex than it might appear. Taking the time to explain the complexity behind your typographic decisions might sound boring, but it will impress. It will also force you to put more consideration into your choices.

Imagery

To many clients, imagery is merely about subject matter. But we know it is about much more. We select imagery based on the mood it sets, the colors it contains and even things such as the eye line of the person in the photograph.

We need to be able to articulate these decisions so that others recognize that you cannot easily substitute one image for another without significantly affecting the design.

Do you know why you selected one image over the thousands of others in your library? What made that image special? Can you explain this to yourself and the client? Was it really more than a “That’ll do� decision?

Styling

For me, styling refers to screen elements that are not directly content-related: buttons, links, call-out boxes and the plethora of other elements that need to be decided on.

How you style these elements can dramatically shape the feel of the website. From the chrome buttons on Apple’s website to the sketched buttons of Moredays, styling can make a huge difference.

A comparison between the navigation on Apple and Moredays
Styling dramatically shapes the feel of your website. But can you justify why one approach is better than another?

Can you explain why your styling creates the right feel? Have you shown the client alternative approaches? Did the client sign off on moodboards, which set the style? If so, refer back to them when justifying your design.

Reference Material

In fact, whenever justifying a design, always refer to the material that has already been agreed upon. For example, if the client has signed off on moodboards, we should use these to justify our choice of typography (“I used the same typeface that we agreed on in the moodboarding stage�). We can also refer to the target audience, business objectives, branding guidelines and even previous comments by the client.

Reference material can be taken from farther afield, too. For example, when justifying your decision to ignore the fold, you can refer to research done by ClickTale. Citing research and experts is a great way to justify an approach.

But remember, being able to explain your design is only half of the objective in this challenge. The other half is about improving the quality of your work.

Improving Our Work

Getting into the habit of justifying your decisions will inevitably improve the quality of your designs. Instead of leaving it to the subconscious, the act of considering imagery, layout, typography and so on becomes a part of your conscious decision-making process.

The act of discussing your process refines it and makes you more efficient as a designer. For example, in carrying out the challenge, you will probably struggle to justify some of your design elements, elements that in hindsight would have been better left out or presented differently. This will inform your next website, and over time you will find that your designs become more refined, simpler and more effective.

So, What Are You Waiting For?

Smashing Magazine has a quite large readership and a remarkable community. We have an amazing opportunity to start talking about our work and providing each other with constructive criticism. Write a blog post on one of your designs, justifying your approach. Then link to it in the comments below. Encourage other people to provide feedback on your design, and take their criticism to heart. Finally, don’t forget to make comments and ask questions of other people who have posted their own work.

My hope is that this post will not only help us speak confidently about our designs and improve the quality of our work, but encourage a dialogue about the design process. We are good at showing off our products but bad at explaining how we came up with them. As a community, we could benefit from more discussion about the process itself, rather than endless inspiration galleries.

(al) (il)


© Paul Boag for Smashing Magazine, 2011.


Showcase of Fabulous Underwater Photography


  

When in search of inspiration, one recipe that tends to always produce successful results is to look at the world around you in a different light, so to speak. This flipped perspective can often lead our thinking and creative processes out of the box, as we see things differently than we normally would. Photographers are fantastic at doing this with a simple location change. By taking their subjects and submerging them in water, or seeking them out under the sea, photographers make some truly stunning captures.

Welcome to our inspirational showcase of underwater photography. These photographers provide a look at a world that we tend to not have access to, and they breathe new perspective into areas we regularly turn to for inspiration, all by taking their lens beneath the surface of the water. We hope you enjoy these often breathtaking and emotive captures.

The Submerged

Dancing Underwater by kenvinpinardy

Underwater 7 by RyanlinOnyx

Underwater by teresa-lynn

Underwater Romance by SonjaMY

UnderWater by Adripics

Underwater Love by Benegesseritt

Underwater Rose 1 by Gimp-artist

Underwater Fashion Shoot 3 by CalciumBirdy

Underwater Portrait 9 by pinuprock

Underwater 2 by foto-agencja

Alice by Bethem

Pearl Shell by borda

.UnderWater. by lectral

8 Lit and in Love by Kai-Tea

Underwater View by Vamaena

Underwater 1 by Momokitty1992

W by adityapudjo

Underwater Reach by Senshisoldier

The Perfect Pose by adityapudjo

Underwater by gemmylostx3

Underwater by foto-agencja

Spring Shake by naked-in-the-rain

Under the Sea

The World Underwater by xthumbtakx

Underwater Dream by nunovix

Jellyfish Munch by Kimbell

Underwater World by nelersa

Underwater in Egypt by Ronald Eliassen Hole

Lagoon, Underwater, Fiji 4 by Derek Keats

Underwater by Oliver Ruhm

Underwater by hosszuka

My Underwater Gardens by VirtualWords

Underwater Beauty by jaris1425

Hawaiian Turtle by manaphoto

The Penguin Dip by SubterfugeMalaises

Galapagos Islands Underwater 3 by Ruth-Yang

Underwater by dimmywho

Underwater by redtrain66

Leafy Sea Dragon by $ewm

Underwater 2 by h4nn4h

(rb)


How Metrics Can Make You A Better Designer





 



 


Metrics can be a touchy subject in design. When I say things like, “Designers should embrace A/B testing� or “Metrics can improve design,� I often hear concerns.

Many designers tell me they feel that metrics displace creativity or create a paint-by-numbers scenario. They don’t want their training and intuition to be overruled by what a chart says a link color should be.

These are valid concerns, if your company thinks it can replace design with metrics. But if you use them correctly, metrics can vastly improve design and make you an even better designer.

First, when I talk about metrics, I’m talking about making use of a couple of very specific tools:

  • User analytics,
  • A/B or multivariate testing.

User analytics are what you might get from Google Analytics, KISSmetrics or Mixpanel. They tell you things like which pages users have viewed the most, which call-to-action buttons they’ve clicked, and how many tasks they’ve performed while using your product. They can also show you where people drop out of critical flows, such as registration and purchasing.

KISSmetrics Shopping Cart Infographic
Shopping Cart Abandonment Infographic by KISSmetrics

A/B and multivariate testing involve looking at how changes affect key metrics such as revenue and retention. When you run an A/B test on a change, you’re comparing user behavior with the new design to user behavior with the old design in order to answer the rather important question of “Which design caused the user to do more of what I wanted and less of what I didn’t want?�

By incorporating analytics and A/B testing into their process, designers can not only improve the business outcomes of their redesign projects, but also become better at design.

Metrics Tell You Where Design Is Needed Most

Unless your resources are unlimited, prioritizing design changes can be tricky. For example, if you’re working on an e-commerce website, who’s to say whether optimizing the sign-up flow is more important than revamping the check-out flow or rebuilding a product page or simplifying the navigation? Any of these could be pretty good ideas.

Metrics are fabulous for making these decisions. For example, analytics can show exactly how much of a drop-off your shopping cart is getting. It can show you precisely how many visitors aren’t converting into signed-in users. It can pinpoint how many people bounce right off of product pages.

Metrics tell you where your biggest business problems really are, so that you can use design to fix them.

Of course, metrics can’t tell you how to actually fix the problems. Your job as a designer is to learn why users might be having problems in certain areas of your product and come up with brilliant solutions.

How Should You Use This?

When deciding on your highest design priority, examine your product’s analytics to identify where your biggest problems are.

Metrics Help You Track Real User Behavior

How many times have you been designing and thought something like, “I wonder how many products people have in their shopping carts on average when they drop out?� Or, “What is the average number of friends a user has in such-and-such a social network?�

Facebook friends
(Image: Adriano Gasparri)

Answers to questions like these can have an enormous impact on the way you design. After all, depending on whether users have no more than a few friends or they tend to have more than a hundred friends, the interaction for selecting from a list can be quite different.

Metrics and analytics free the designer from having to guess the answers to questions like these.

Again, knowing the answers doesn’t tell you how to design the product, but it does give you a lot more insight into the real problems you’re trying to solve.

How Should You Use This?

The next time you’re debating with someone about where users are dropping out of a flow or how many users are watching a video tutorial, remember that these questions are easily answered by metrics.

Or if you’re trying to decide what sort of widget to use to access some data, remember that the right solution often depends on how much data there will be, and that question is entirely answerable as well.

Metrics Tell You Which Changes Are Most Effective

Let’s be clear. Your job as a designer is to improve the customer experience in some measurable way, right? If you do a complete redesign, and every designer you know loves it, and it wins awards from experts, but every single one of your users hates it and leaves and stops giving you money, then that’s a failure for the company.

Design changes — like code changes, marketing changes and customer service changes — should eventually make a company more money, because that’s how the company will stay in business and pay the designer’s salary.

With metrics, you can learn exactly what sort of an effect your changes will have on the numbers you care about.

Let’s say you’ve been obsessing over the navigation of your website. You feel it’s confusing for users and is frustrating them and causing them to leave. So, you revamp the navigation and run an A/B test so that half of users see the old version and half see the new one.

After a few thousand people have seen both versions, you have a very good idea whether changing the navigation has resulted in good things like increased revenue, time on site, and the number of users who would recommend you to a friend.

Of course, not every change you make will have a direct and significant impact on revenue. But knowing that any major change you make is having a measurable influence on the things you care about is very nice.

As a bonus, once you’ve made a few demonstrable improvements to revenue, asking for a raise or for more design resources becomes a lot easier.

How Should You Use This?

Get into the habit of A/B testing your design changes.

Obviously, you can make a few changes that you know will negatively affect certain metrics because they’re part of a larger strategy. But at some point you need to put a stake in the ground and say, “If we make the following design changes, then important metrics such as revenue and retention will improve.�

If you test all of your design changes against the status quo, you should eventually see those key metrics go up as a result of your work.

Metrics Give You The Freedom To Take Design Risks

Big design changes can involve big risks. After all, if what you’re proposing has the potential to vastly increase revenue, then it also has the potential to vastly decrease revenue.

Knowing that all of your changes will be A/B tested gives you a tremendous amount of freedom to try new and potentially dangerous things. If they pay off, you’ll find out immediately. If they cause problems, you can identify and fix them quickly.

You no longer need to worry that some change you’ve made will mysteriously ruin everything. And if you weren’t worried about that before, you probably should have been, because even very small design and text changes can have an enormous impact on user behavior.

How Should You Use This?

Be bold! The next time you’re inclined not to make an important change because you’re concerned it might have a negative impact, go ahead and try it. Roll the change out to 10% of your users, and get real data on whether it helps or hurts the product.

What Metrics Won’t Do

A lot of the push-back I get on measuring design is based on a fundamental misunderstanding of A/B testing and analytics. Some designers hear about Google testing dozens of shades of blue, and they feel that design shouldn’t be reduced to that level. After all, design is more than about picking a shade of blue.

Which blue is better?
Which blue is better? (Image: visualpanic)

In fact, metrics are terrible for a lot of things that design does well. For example, metrics can’t tell you how exactly to improve a design. They can only tell you whether your design is better or worse than another. They can tell you exactly what users are doing, but they can’t tell you why they’re doing it or how to make them stop.

Metrics can be an incredibly powerful tool, but they don’t replace design or make it irrelevant. In the end, the designers are still the ones making the decisions. They’re just making them with better information.

Want To Get Started?

(al)


© Laura Klein for Smashing Magazine, 2011.


  •   
  • Copyright © 1996-2010 BlogmyQuery - BMQ. All rights reserved.
    iDream theme by Templates Next | Powered by WordPress