Is Your Site's Code Bringing Down Your ROI?

By Joe Lucas

It's a well known fact that good site design is crucial to site performance. What’s not as easily understood, however, is exactly what constitutes 'good site design.' 

In my job as a Sales Engineer at ClickTracks, one thing I encounter almost daily basis are web sites that have been poorly built from the ground up.  What I mean by this is that in addition to ignoring the 'basic' good site design rules-- unique page titles, smart navigation, CSS, etc.--these sites are also missing strong coding techniques. 

If your web site falls into the above category, does that mean you are doomed to a life of less than optimal performance from your site?  Not necessarily—there are things you can do to help provide your site with the solid foundation it needs. In this article, I'm going to highlight some basic tips that you can implement that will enhance your overall site performance, lower your costs, and deliver higher ROI.

Choose your platform correctly

How important is your site’s platform to its overall performance?  In my opinion, it’s the most important thing.  Platform choices include everything from your server architecture, to your programming language, and your backend data choices.  You’ll want to evaluate a few things here. 

  • Overall site performance: You want your pages to load as quickly as possible--so, faster servers and optimized code are essential. 
  • Database considerations: If your data and content are stored in a database, you’ll want to pay special attention to your database structure.  If you're loading content directly from a database on every page, you’ll want to think about how the content is laid out in your database. 
  • Table layout: Picking the right table layout and key indices can really improve performance, and may even boost speed. If we take the example of a MySQL database, for instance, there are a few different table types that you can choose.  This can affect overall performance of the database depending on which you select as well as how much overhead that table type brings to the database itself. 
  • Data flow: Understanding how the data flows from your database to your page will allow you to have better database architecture and really improve performance.

You’ll also want to choose your scripting language carefully.  If you decide to go with a PHP/Linux server set up, make sure that the language will really allow you to do what you want with the site.  Would your overall goals be better achieved on a Java platform?  Look at your development resources as well as the type of content you wish to publish. 

Object-Oriented Design is your Friend

Most web languages now support some type of object-oriented design—and if this option is available to you, you should use it.  Maintaining your site and pushing updates will be much easier if you make use of an object-oriented backend. 

If object-oriented design isn't available, you can make the best of the situation by taking advantage of file includes and a template-based design. Taking this approach is a viable workaround if an object-oriented approach isn't in the cards for your site. 

Let’s take a look at how includes and templates can improve the ease of maintaining your site.  Consider the following example written in PHP

<?
include “/header.php”;

$html=”Some Page content Here”;
print $html;

include “/footer.php”;
?>

That seemed simple enough.  I’ve got a common header file and a common footer file.  So, if I needed to make any updates to my footer or header I can easily do it in one file and have the changes propagate live throughout the site.  But should we stop there?  No way!  Maybe we can do something similar with a common navigation include to make updates to the navigation much more efficient, as well.  Let's check out the code for that:

<?
include “/header.php”;
include “/navigation.php”;

$html=”Some Page content Here”;
print $html;

include “/footer.php”;
?>

One additional line of code is all it takes to make that happen—excellent!  The code above should be fairly easy to maintain while still allowing a good degree of customization. 

This is probably the easiest way of building a large site in PHP, but it’s not without its own limitations—think about things like unique page titles.  In order to give each page a unique title, we either need to give up the header include and hard code the header information into each page (the least appealing and most time-consuming option) or we could make the code more complex in order to facilitate a dynamic page title. 

Another drawback to the template/include approach is if we wanted to add content to the page after deployment.  Perhaps we wanted to change the layout of the page slightly and introduce a right column that would display advertisements.  In order to do this, we would now need to edit possibly hundreds of pages in order to make this change.  This is a pretty monotonous and time consuming task—and one that will get pushed to the back burner as a result. 

So what's the answer? By deploying an object-oriented approach to the site, we can overcome these obstacles while still maintaining a template-like design.  Let’s revisit this example using an object oriented approach.

<?
include “/page.php”;
$page=new page();
print $page->createPage(“Page Title”, “PageID”);
?>

Example of page.php:

<?
class page{
            function createPage($title, $id){
                        $html=”<html><head><title>$title</title></head><body><p>Page ID: $id</p></body></html>”;
                        return $html;
            }
}
?>

In the above code snippets, we’ve succeeded in doing two things:  First, we've shortened the code that initializes each page, which means a lower overall file size and a faster load. Then, we've also created a central access point for updates.  Now, no matter what needs to be done to the overall page layout on your site, you only have one place to go to make changes and push them live.  You can pass in custom content, or in the above example, just a page ID which could be used to grab content from a database and put into the page. 

We’ve also then succeeded in being able to have a template design for easy maintenance, as well as preserving a unique aspect of each page. 

Optimizing your Code

Another great way to improve overall performance is to optimize your code.  If you’re pulling content from a database, are you using the right SQL query, or are you pulling a lot more information from the database and then going through everything to pull just the content you need?  Are you closing your database connections after running your query?  Do you have a lot of white space in your code that unnecessarily inflates the file size?  Can you accomplish in 5 lines what you’re doing in 10?  I’ve certainly been guilty of all of these in the past--writing good code is hard on the first pass.  That's why, after you’ve deployed your site, it makes sense to go back through your code and see where you can make improvements.  This is a concept called 'code refactoring'—and it plays an important role in ensuring you’re your site code is as optimized as possible.

Is this all there is to know about improving site performance?  Certainly not—it's just the tip of the proverbial iceberg.  This is what it comes down to:  Building a web site correctly from the ground up will impact every decision you will make for the lifetime of that site.  Making the right choices early on will save money and improve the overall financial performance of the site.  And after all, isn't that one of the goals you're after?

###

Joe Lucas is a Professional Services guru at ClickTracks. Our Professional Services department offers one-on-one interactive sessions to help you with search engine optimization, campaign management, and web analytics. Contact Professional Services or call us 877-773-2249 (+831-621-6380 outside the U.S.).


Search The InsideTrack

Lyris HQ

As an online marketer, you
manage your email marketing,
your web content, landing pages, and PPC along with analyzing each for effectiveness. With Lyris HQ, you can manage all your online marketing programs easily and effectively from a single integrated toolset.

Request a demo >>


ClickTracks Pro 6.7.3

ClickTracks Pro 6.7.3 (software/log file edition) includes several feature updates, including: forensics for all campaigns, improved user and group controls, and an upgraded Campaign Manager.

Contact your sales rep for details on upgrading.


Live Interactive Demo

Four times a week, we present a live, interactive demonstration of ClickTracks' key features.

Reserve your seat today >>


See us @

02/26 - 02/28
SMX West - Santa Clara

03/17 - 03/20
SES - New York



Receive the Newsletter