Pages

Thursday, January 17, 2013

How To Create Custom Post Meta Boxes In WordPress

By
from: http://wp.smashingmagazine.com/2011/10/04/create-custom-post-meta-boxes-wordpress/

What seems like one of the most complicated bits of functionality in WordPress is adding meta boxes to the post editing screen. This complexity only grows as more and more tutorials are written on the process with weird loops and arrays. Even meta box “frameworks” have been developed. I’ll let you in on a little secret though: it’s not that complicated.
sm-wp_meta-boxes
Creating custom meta boxes is extremely simple, at least it is once you’ve created your first one using the tools baked into WordPress’ core code. In this tutorial, I’ll walk you through everything you need to know about meta boxes:
  • Creating meta boxes.
  • Using meta boxes with any post type.
  • Handling data validation.
  • Saving custom meta data.
  • Retrieving custom meta data on the front end.
Note: When I use the term “post” throughout this tutorial, I’m referring to a post of any post type, not just the default blog post type bundled with WordPress.
(Smashing’s note: If you are looking for a good book on mobile, this is the one. Our brand new book on best design and coding practices for mobile, Responsive Web design and UX design for mobile. Get it now!)

What is a post meta box?

A post meta box is a draggable box shown on the post editing screen. Its purpose is to allow the user to select or enter information in addition to the main post content. This information should be related to the post in some way.
Generally, two types of data is entered into meta boxes:
  • Metadata (i.e. custom fields),
  • Taxonomy terms.
Of course, there are other possible uses, but those two are the most common. For the purposes of this tutorial, you’ll be learning how to develop meta boxes that handle custom post metadata.

What is post metadata?

Post metadata is data that’s saved in the wp_postmeta table in the database. Each entry is saved as four fields in this table:
  • meta_id: A unique ID for this specific metadata.
  • post_id: The post ID this metadata is attached to.
  • meta_key: A key used to identify the data (you’ll work with this often).
  • meta_value: The value of the metadata.
In the following screenshot, you can see how this looks in the database.

When you get right down to it, metadata is just key/value pairs saved for a specific post. This allows you to add all sorts of custom data to your posts. It is especially useful when you’re developing custom post types.
The only limit is your imagination.
Note: One thing to keep in mind is that a single meta key can have multiple meta values. This isn’t a common use, but it can be extremely powerful.

Working with post metadata

By now, you’re probably itching to build some custom meta boxes. However, to understand how custom meta boxes are useful, you must understand how to add, update, delete, and get post metadata.
I could write a book on the various ways to use metadata, but that’s not the main purpose of this tutorial. You can use the following links to learn how the post meta functions work in WordPress if you’re unfamiliar with them.
The remainder of this tutorial assumes that you’re at least familiar with how these functions work.

The setup

Before building meta boxes, you must have some ideas about what type of metadata you want to use. This tutorial will focus on building a meta box that saves a custom post CSS class, which can be used to style posts.
I’ll start you off by teaching you to develop custom code that does a few extremely simple things:
  • Adds an input box for you to add a custom post class (the meta box).
  • Saves the post class for the smashing_post_class meta key.
  • Filters the post_class hook to add your custom post class.
You can do much more complex things with meta boxes, but you need to learn the basics first.
All of the PHP code in the following sections goes into either your custom plugin file or your theme’s functions.php file.

Building a custom post meta box

Now that you know what you’re building, it’s time to start diving into some code. The first two code snippets in this section of the tutorial are mostly about setting everything up for the meta box functionality.
Since you only want your post meta box to appear on the post editor screen in the admin, you’ll use the load-post.php and load-post-new.php hooks to initialize your meta box code.
1/* Fire our meta box setup function on the post editor screen. */
2add_action( 'load-post.php', 'smashing_post_meta_boxes_setup' );
3add_action( 'load-post-new.php', 'smashing_post_meta_boxes_setup' );
Most WordPress developers should be familiar with how hooks work, so this should not be anything new to you. The above code tells WordPress that you want to fire the smashing_post_meta_boxes_setup function on the post editor screen. The next step is to create this function.
The following code snippet will add your meta box creation function to the add_meta_boxes hook. WordPress provides this hook to add meta boxes.
1/* Meta box setup function. */
2function smashing_post_meta_boxes_setup() {
3
4    /* Add meta boxes on the 'add_meta_boxes' hook. */
5    add_action( 'add_meta_boxes', 'smashing_add_post_meta_boxes' );
6}
Now, you can get into the fun stuff.
In the above code snippet, you added the smashing_add_post_meta_boxes() function to the add_meta_boxes hook. This function’s purpose should be to add post meta boxes.
In the next example, you’ll create a single meta box using the add_meta_box() WordPress function. However, you can add as many meta boxes as you like at this point when developing your own projects.
Before proceeding, let’s look at the add_meta_box() function:
1add_meta_box( $id, $title, $callback, $page, $context = 'advanced', $priority = 'default', $callback_args = null );
  • $id: This is a unique ID assigned to your meta box. It should have a unique prefix and be valid HTML.
  • $title: The title of the meta box. Remember to internationalize this for translators.
  • $callback: The callback function that displays the output of your meta box.
  • $page: The admin page to display the meta box on. In our case, this would be the name of the post type (post, page, or a custom post type).
  • $context: Where on the page the meta box should be shown. The available options are normal, advanced, and side.
  • $priority: How high/low the meta box should be prioritized. The available options are default, core, high, and low.
  • $callback_args: An array of custom arguments you can pass to your $callback function as the second parameter.
The following code will add the post class meta box to the post editor screen.
01/* Create one or more meta boxes to be displayed on the post editor screen. */
02function smashing_add_post_meta_boxes() {
03
04    add_meta_box(
05        'smashing-post-class',          // Unique ID
06        esc_html__( 'Post Class', 'example' ),      // Title
07        'smashing_post_class_meta_box',     // Callback function
08        'post',                 // Admin page (or post type)
09        'side',                 // Context
10        'default'                   // Priority
11    );
12}
You still need to display the meta box’s HTML though. That’s where the smashing_post_class_meta_box() function comes in ($callback parameter from above).
01/* Display the post meta box. */
02function smashing_post_class_meta_box( $object, $box ) { ?>
03
04    <?php wp_nonce_field( basename( __FILE__ ), 'smashing_post_class_nonce' ); ?>
05
06    <p>
07        <label for="smashing-post-class"><?php _e( "Add a custom CSS class, which will be applied to WordPress' post class.", 'example' ); ?></label>
08        <br />
09        <input class="widefat" type="text" name="smashing-post-class" id="smashing-post-class" value="<?php echo esc_attr( get_post_meta( $object->ID, 'smashing_post_class', true ) ); ?>" size="30" />
10    </p>
11<?php }
What the above function does is display the HTML output for your meta box. It displays a hidden nonce input (you can read more about nonces on the WordPress Codex). It then displays an input element for adding a custom post class as well as output the custom class if one has been input.
At this point, you should have a nice-looking meta box on your post editing screen. It should look like the following screenshot.

The meta box doesn’t actually do anything yet though. For example, it won’t save your custom post class. That’s what the next section of this tutorial is about.

Saving the meta box data

Now that you’ve learned how to create a meta box, it’s time to learn how to save post metadata.
Remember that smashing_post_meta_boxes_setup() function you created earlier? You need to modify that a bit. You’ll want to add the following code to it.
1/* Save post meta on the 'save_post' hook. */
2add_action( 'save_post', 'smashing_save_post_class_meta', 10, 2 );
So, that function will actually look like this:
1/* Meta box setup function. */
2function smashing_post_meta_boxes_setup() {
3
4    /* Add meta boxes on the 'add_meta_boxes' hook. */
5    add_action( 'add_meta_boxes', 'smashing_add_post_meta_boxes' );
6
7    /* Save post meta on the 'save_post' hook. */
8    add_action( 'save_post', 'smashing_save_post_class_meta', 10, 2 );
9}
The new code you’re adding tells WordPress that you want to run a custom function on the save_post hook. This function will save, update, or delete your custom post meta.
When saving post meta, your function needs to run through a number of processes:
  • Verify the nonce set in the meta box function.
  • Check that the current user has permission to edit the post.
  • Grab the posted input value from $_POST.
  • Decide whether the meta should be added, updated, or deleted based on the posted value and the old value.
I’ve left the following function somewhat generic so that you’ll have a little flexibility when developing your own meta boxes. It is the final snippet of code that you’ll need to save the metadata for your custom post class meta box.
01/* Save the meta box's post metadata. */
02function smashing_save_post_class_meta( $post_id, $post ) {
03
04    /* Verify the nonce before proceeding. */
05    if ( !isset( $_POST['smashing_post_class_nonce'] ) || !wp_verify_nonce( $_POST['smashing_post_class_nonce'], basename( __FILE__ ) ) )
06        return $post_id;
07
08    /* Get the post type object. */
09    $post_type = get_post_type_object( $post->post_type );
10
11    /* Check if the current user has permission to edit the post. */
12    if ( !current_user_can( $post_type->cap->edit_post, $post_id ) )
13        return $post_id;
14
15    /* Get the posted data and sanitize it for use as an HTML class. */
16    $new_meta_value = ( isset( $_POST['smashing-post-class'] ) ? sanitize_html_class( $_POST['smashing-post-class'] ) : '' );
17
18    /* Get the meta key. */
19    $meta_key = 'smashing_post_class';
20
21    /* Get the meta value of the custom field key. */
22    $meta_value = get_post_meta( $post_id, $meta_key, true );
23
24    /* If a new meta value was added and there was no previous value, add it. */
25    if ( $new_meta_value && '' == $meta_value )
26        add_post_meta( $post_id, $meta_key, $new_meta_value, true );
27
28    /* If the new meta value does not match the old value, update it. */
29    elseif ( $new_meta_value && $new_meta_value != $meta_value )
30        update_post_meta( $post_id, $meta_key, $new_meta_value );
31
32    /* If there is no new meta value but an old value exists, delete it. */
33    elseif ( '' == $new_meta_value && $meta_value )
34        delete_post_meta( $post_id, $meta_key, $meta_value );
35}
At this point, you can save, update, or delete the data in the “Post Class” meta box you created from the post editor screen.

Using the metadata from meta boxes

So you have a custom post meta box that works, but you still need to do something with the metadata that it saves. That’s the point of creating meta boxes. What to do with your metadata will change from project to project, so this is not something I can answer for you. However, you will learn how to use the metadata from the meta box you’ve created.
Since you’ve been building a meta box that allows a user to input a custom post class, you’ll need to filter WordPress’ post_class hook so that the custom class appears alongside the other post classes.
Remember that get_post_meta() function from much earlier in the tutorial? You’ll need that too.
The following code adds the custom post class (if one is given) from your custom meta box.
01/* Filter the post class hook with our custom post class function. */
02add_filter( 'post_class', 'smashing_post_class' );
03
04function smashing_post_class( $classes ) {
05
06    /* Get the current post ID. */
07    $post_id = get_the_ID();
08
09    /* If we have a post ID, proceed. */
10    if ( !empty( $post_id ) ) {
11
12        /* Get the custom post class. */
13        $post_class = get_post_meta( $post_id, 'smashing_post_class', true );
14
15        /* If a post class was input, sanitize it and add it to the post class array. */
16        if ( !empty( $post_class ) )
17            $classes[] = sanitize_html_class( $post_class );
18    }
19
20    return $classes;
21}
If you look at the source code of the page where this post is shown on the front end of the site, you’ll see something like the following screenshot.
post-class-source-code
Pretty cool, right? You can use this custom class to style posts however you want in your theme’s stylesheet.

Security

One thing you should keep in mind when saving data is security. Security is a lengthy topic and is outside the scope of this article. However, I thought it best to at least remind you to keep security in mind.
You’ve already been given a link explaining nonces earlier in this tutorial. The other resource I want to provide you with is the WordPress Codex guide on data validation. This documentation will be your best friend when learning how to save post metadata and will provide you with the tools you’ll need for keeping your plugins/themes secure.
Bonus points to anyone who can name all of the security measures used throughout this tutorial.

Create a custom meta box

Once you’ve copied, pasted, and tested the bits of pieces of code from this tutorial, I encourage you to try out something even more complex. If you really want to see how powerful meta boxes and post metadata can be, try doing something with a single meta key and multiple meta values for that key (it’s challenging).
I hope you’ve enjoyed the tutorial. Feel free to post questions about creating meta boxes in the comments.



find more on http://sunfeng.ca/

Tutorial: How to write a WordPress Plugin?

December 27th in Wordpress by .

WordPress is not just a blogging platform and it is such a powerful CMS with unlimited capabilities, besides having a huge user base. Almost anything can be scripted with wordpress. You can extend wordpress either by means of plugin or by a theme.
In this tutorial, i will show you how to write a Hello World wordpress plugin, which unlike many believe is surprisingly easy, once you understand the very fundamentals. All you need to have is a basic knowledge of php scripting.
Before we move on coding a plugin, please make sure you remember the following coding practices.
1. Always you chose a unique name to your plugin so that it doesnt collide with names used in other plugins.
2. Make sure you comment wherever and whenever necessary in the code.
3. You will to test the plugin in your localhost (using xampp) along with latest version of wordpress.

Plugin Files & Names

Assigning unique names, documenting and organizing the plugin files is very important part of plugin creation.

Although wordpress allows you to place the plugin php file directly into the wp-content/plugins folder, for a good plugin developer you will need to create a folder named hello-world and within place readme.txt and hello-world.php.
The readme.txt contains information about your plugin and can come in handy when you submit your plugin wordpress SVN plugin repository. See the readme sample.
Go ahead and create these files and we will add the content to these files later.

The Plugin Basics

The heart of a wordpress plugins is the below 2 functions (commonly called `hooks`)
add_action ($tag, $func) documentation
add_filter ($tag,$func) documentation
It is very important to know the difference between the above functions.
  • add_action –> does an action at various points of wordpress execution
  • add_filter –> does filtering the data (eg. escaping quotes before mysql insert, or during output to browser.
Refer to the WordPress Plugin API for more better understanding.

Plugin Information

Open your hello-world.php and in the first line, add this commented plugin information to your file.
<?php
/*
Plugin Name: Hello-World
Plugin URI: http://yourdomain.com/
Description: A simple hello world wordpress plugin
Version: 1.0
Author: Balakrishnan
Author URI: http://yourdomain.com
License: GPL
*/
?>
Save this php file,
  • Place the plugin folder to wordpress > wp-content > plugins,
  • Go to your wordpress admin > plugins and you will see the new plugin listed, waiting to get activated.
simple ain’t it?

But this plugin had to do something right?

Why not we make it print  “Hello World” when we call it from wordpress theme template files.
for that we write the code using add_action below the commented plugin information in the hello-world.php
<?php
/*
Plugin Name: Hello-World
Plugin URI: http://yourdomain.com/
Description: A simple hello world wordpress plugin
Version: 1.0
Author: Balakrishnan
Author URI: http://yourdomain.com
License: GPL
*/
/* This calls hello_world() function when wordpress initializes.*/
/* Note that the hello_world doesnt have brackets.
add_action('init','hello_world');
function hello_world()
{
echo "Hello World";
}
?>
Thats it! Our Hello World plugin is nearly done and with just few lines of code. When our plugin is activated, add_action command calls our hello_world() function when wordpress starts loading.

Lets Test our Hello World Plugin

We really dont know whether our plugin works or not. To test our plugin, go to plugins, activate the hello-world plugin.
Then open your worldpress theme wp-content > themes > default, open any of index.php, archive.php or single.php and place the following code anywhere.
<?php
if(function_exists('hello_world')) {
hello_world();
}
?>
The key here is function_exists() call which checks whether plugin loaded or not and then allows the hook into the plugin function.  Call to hello_world() in the theme files without checking it, often leads to “Fatal error: call to undefined function” and our blog would crash, if the hello world plugin is not activated or deleted.

If you carefully notice above graphic, see how the hello world appears. Thats the work of our plugin. It WORKS!

Lets take our plugin one step further!

Why not, we build a plugin options page in admin area and provide a backend for plugin users?
Right now, the plugin outputs hello world (its pretty much static) and if somebody wants to output ‘Hello Example’, they need to open the php file and make changes everytime to print different text.
Asking the user to edit plugin files isnt a good idea!  As a wordpress plugin developer, it is you, who has to provide a good wordpress options interface in the wp-admin area.

Writing Plugin Options Page

We now create  Hello World options page in the wordpress admin area.

Here is what we do….
  • When plugin gets activated, we create new database field `wp_hello_world_data` using set_options() function.
  • When plugin gets deactivated, we delete the database field `wp_hello_world_data`
  • We create a options menu for Hello World in WordPress Admin > Settings.
  • We save the user entered data in the wordpress database.
  • We retrieve the data stored in wordpress database and output it using get_options() function.
Why we are creating database field? because the saved data must be saved somewhere? ie. in wordpress database. This way the plugin outputs user entered text, instead of the static “Hello World”.

Activating/Deactivating Plugin

It is very easy to write a function on what plugin does, when it gets activated. WordPress offers 4 very important functions
<?php
/* Runs when plugin is activated */
register_activation_hook(__FILE__,'hello_world_install'); 

/* Runs on plugin deactivation*/
register_deactivation_hook( __FILE__, 'hello_world_remove' );

function hello_world_install() {
/* Creates new database field */
add_option("hello_world_data", 'Default', '', 'yes');
}

function hello_world_remove() {
/* Deletes the database field */
delete_option('hello_world_data');
}

?>
The above code creates the new database field `hello_world_data` using add_options and it runs when we activate the plugin. It has the value ‘default’ since we explicitly define it.
Similarly when the plugin gets deactivated or removed, we need to clean up things, so we remove the created database field using delete_option.

Plugin Settings Page

This is our final step.  All we need to create is plugin settings page in the wordpress admin area.  The settings page will update and save the data to the database field `hello_world_data` which we created while activating the plugin. Be sure to checkout creating options page in wordpress codex.
Here is a very important thing to remember:
The add_action for admin_menu should call a function hello_world_admin_menu() containing add_options_page, which in turn should call a function hello_world_html_code() containing html code. This is how the code should flow! Refer to wordpress administration menus
<?php
if ( is_admin() ){

/* Call the html code */
add_action('admin_menu', 'hello_world_admin_menu');

function hello_world_admin_menu() {
add_options_page('Hello World', 'Hello World', 'administrator',
'hello-world', 'hello_world_html_page');
}
}
?>
The above code, is placed under is_admin() which means it only runs in the wordpress admin area.
The below function has the html code for the settings page, containing the form and notice how the php tag is split to accomodate the html code.

and the coding part is..
<?php
function hello_world_html_page() {
?>
<div>
<h2>Hello World Options</h2>

<form method="post" action="options.php">
<?php wp_nonce_field('update-options'); ?>

<table width="510">
<tr valign="top">
<th width="92" scope="row">Enter Text</th>
<td width="406">
<input name="hello_world_data" type="text" id="hello_world_data"
value="<?php echo get_option('hello_world_data'); ?>" />
(ex. Hello World)</td>
</tr>
</table>

<input type="hidden" name="action" value="update" />
<input type="hidden" name="page_options" value="hello_world_data" />

<p>
<input type="submit" value="<?php _e('Save Changes') ?>" />
</p>

</form>
</div>
<?php
}
?>
You must remember 2 things in the above code.
1. Specify the database field we created before in the input text box as `hello_world_data`
<input name="hello_world_data" type="text" id="hello_world_data"
value="<?php echo get_option('hello_world_data'); ?>" />

2. If your form has number of fields (like textbox, selectbox etc), all those should be listed in the value field of page_options, separated by commas. For more information, refer to wordpress documentation
<input type="hidden" name="page_options" value="hello_world_data" />
Now, the plugin outputs whatever the user specifies in the hello world settings page.
Thats it! Our plugin is READY!
Dont forget to add documentation to readme.txt.
Enjoy!
___________________________________________

find more on http://sunfeng.ca/ 

Saturday, January 12, 2013

How to find new SEO opportunities with Google Analytics and Webmaster Tools

October 20, 2011By: Julien Simon
from: http://www.6smarketing.com/how-to-find-new-seo-opportunities-with-google-webmaster-tools-integration-in-google-analytics/
On October 4 2011, Google announced that search queries data from the Google Webmaster tools were now available in Google Analytics. What does that mean for you and your website? Well, as SEO specialists, we are always looking for new ways to find opportunities to increase traffic, conversions and revenue on a website. The integration of Google Webmaster Queries in Google Analytics allows us to find these golden opportunities. Let’s look at what new data these reports allow us to look at.

The New Reports

Enabling Google Webmaster Tools in Google Analytics will give you access to this data: (click on images throughout the blog post to enlarge them)

1) Queries

From this tab, you can see the queries which related to your website and sort them by impressions, clicks, average position and CTR. This can be very useful:
Google Analytics SEO queries
One thing to keep in mind is that the average position is not the ranking for these keywords but the average position out of all the impressions. It could mean that if you have multiple positions for a single keyphrase, it will take the average of all impressions and not the highest ranking.
From Google’s Webmaster Help:
“To calculate average position, we take into account the ranking of your site for a particular query
(for example, if a query returns your site as the #1 and #2 result, then the average position would be 1.5).”
However, beside the keywords for which you rank multiple times for, you can assume that the average position equals the average ranking. The rest of the information presented in this report can be quite useful. We will elaborate on that later in this post.

2) Landing Pages

This report is basically the same as the one described above except it shows pages instead or queries:
Google Analytics SEO landing pagesThe average position report is interesting but requires more digging to see which keywords a page actually ranks for. However, data like impressions and CTR can be very useful to gauge the potential power of a page.

3)   Geographical Summary

This report is mostly useful for sites with an international audience and reports the same data sorted by countries:
Google Analytics SEO countriesYou can also change the “view” to compare clicks per impression per country for example and see the relevancy of your search results on country per country basis.

4) Google Property

Hidden in the Geographical Summary is a tab called Google Property which gives you an overall picture of what channels your website is most listed in:
GA SEO Google PropertyThis helps you determine which areas you need to focus on. You could also decide to create/improve the mobile version of your website if the number of impressions and clicks is not high enough.

How to Find SEO Opportunities within the Search Engine Optimization Report?

The main advantages of enabling the migration of data from Google Webmaster Tools to Google Analytics are that Google Analytics now allows you to:
  • Set up a secondary dimension such as “Google Property” which tells you where each query is being displayed
  • Change the view to “comparison” and sort that data by Clicks, impressions, CTR, Average position very easily, while comparing the results to the site average or to other queries.
  • Apply filters to sort the data in more details.
Google Analytics SEO advantagesFilters could help you find keywords that rank on average on the second page of Google, find keywords that rank on the first two pages of Google but have a low CTR and so on…depending on what your goals are, there are several filters that would make your life as an SEO specialist a lot easier. Let’s look at some concrete examples:

Finding SEO Opportunities:

Pages with traffic opportunity

On the landing pages tab of the search engine optimization report, apply a filter to show the pages with high impressions (the number will vary depending on your website) and an average position below 7:
filter page with opportunityApplying this filter to our test website helped me find a secondary page that doesn’t drive very much traffic:
SEO opportunity Traffic pages105 visitors in a month isn’t very many and this page isn’t a primary focus of this website. However, when looking at the new search engine optimization report within Google Analytics with the filter described above, we can see that this page has the potential to drive tons of traffic:
SEO Opportunity Pages with trafficIt’s the number #1 landing page in terms of impressions with 60,000 impressions in a month, way above the home page of the website which had6,500. However, the average position of that page is only 8.5 so increasing its average position to the top 5 or top 3 and tweaking the description tag to make the listing more appealing could potentially drive a lot more traffic.

Pages with keyword cannibalization issue opportunity

Finding keyword cannibalization isn’t easy because at least two pages are involved and cross matching data is necessary. There are no magic filters that will find these pages for you. However, it is possible to find these pages with some digging and filtering.
For example, I applied a filter on our test website to find pages that ranked well but had a low CTR, therefore didn’t seem relevant to users:
SEO keyword cannibalization FilterI looked at the page that showed up #1 in that result.  After checking that the title and meta description were correct, deeper research allowed us to find the following information:
SEO Opportunity Pages with keyword cannibalizationWhen looking at this page’s statistics, you see that it doesn’t drive a ton of traffic. Also, you will notice that the bounce rate is really high, which is a bad sign. When looking at the report from Google Webmaster Tools, we can see that the page ranks fairly high with an average position of 3.7:
SEO Opportunity Pages with keyword cannibalizationThere was a clear opportunity with a page that ranks high enough to drive traffic but doesn’t actually receive clicks and has a high bounce rate. To investigate further, the keywords that drove traffic to the page were compared against the list of keywords that were targeted for that page. It turns out that the keywords bringing traffic to this page were not all relevant. Moreover, when I looked at the search results for important keywords, another page from the same site ranked higher while being less relevant for these keywords. It was a typical case of keyword cannibalization where on-page SEO tweaks to both pages would help rectifying the SEO issues, and drive more relevant traffic to both pages.

Pages with conversions opportunity

The process for trying to find pages with high conversion opportunities I follow is:
  • Look at the top ‘X’ pages with the most traffic (Number of pages can vary depending on size of website).
  • Look at the top ‘X’ pages with the most conversions.
  • Check these pages in the “Search engine optimization” part of the Google Analytics report and look for their impressions, CTR and average position.
  • Then cross match all the data and hope some pages will jump out like this one:
Pages with conversions SEO OpportunityThis page has a fair amount of traffic compared to the average on the site, and is the third highest landing page. The high bounce is a bit alarming. However, this page sells big industrial products and when looking at some keywords driving traffic to this page, we can see that some keywords apply for both B2B and B2C. The B2B part of the traffic is converting much better, when the B2C part of the traffic bounces out.
When looking at the top pages with the most conversions, this page ranks number 4, which is quite good (I applied the advanced segment: “visits with conversion”):landing page with conversion
The “search engine optimization” report from Google Analytics tells us that this page ranks on average at the 15th position in Google Web search results:
SEO landing page with conversion
All this data put together tells us that this page is one of the pages that drive the most traffic and that convert the most. However, this page has a huge bounce rate, and ranks poorly on a few of the keywords it is listed for. Increasing the average ranking from 15 to top 5, and reducing the bounce rate from 75% to at least the 40-50% range would make a significant improvement and could potentially drive a lot more traffic and conversions.
These 3 examples showed you how using the “Search Engine Optimization” part of the Google Analytics report can help you find SEO opportunities. What do you think? Do you use this part of the report? If not, will you start using it now?

find more on http://sunfeng.ca/