Building a Website for Analytics

Building a Website for Analytics

Got something to say?

Share your comments on this topic with other web professionals

In: Articles

By Jeff Cram

Published on October 16, 2006

How to get it right the first time around

Implementing a web analytics solution is a mission-critical activity for any business serious about succeeding online. Without a comprehensive ability to analyze your site’s traffic, you’ll be unable to determine the effectiveness of your website, online marketing campaigns, and overall online business objectives.

Many companies don’t think about measurement when building a site, and they get stuck trying to retrofit it later. This can be a tough task. There are numerous technological decisions that will have an impact on your measurement strategy, your report accuracy, and your ability to analyze the data. Let’s look at a few key points that will help you to ensure accurate and effective analytics.

It all starts with strategic planning

Web analytics experts—and common sense—will tell you that upfront planning is the key to a successful measurement program. In short, without deciding in advance what you want to measure, you’ll have an exceedingly difficult time constructing a solution that gives you the information you need. You simply can’t improve the results of your analysis without first defining the key metrics that have an impact on your business.

Measurement plans come in all shapes and sizes. Each business has different goals, specific ways to segment visitors, and different priorities placed on key performance indicators. For an e-commerce site, it’s essential to look closely at conversion rates and shopping-cart abandonment, while a content-driven site might be more concerned about the time spent on the site, advertising impressions, and subscription conversion rates.

While planning is critical, the next step is to make sure that your measurement and technology teams are working in tandem. It’s time to knock down those cubicle walls, crack open a Red Bull or two, and start working together. There are technical challenges that need to be addressed in order to ensure that your analytics solution provides information you need.

You can’t report on data you don’t collect

Almost all leading web analytics solutions use client-side tagging to collect data, which generally involves placing a small snippet of JavaScript code on every page of your site. A good example is the popular Google Analytics, which requires your site to include code such as the following on your pages:

     <script src="" type="text/javascript"></script>     <script type="text/javascript">         _uacct = "<tracking number goes here>";         urchinTracker();     </script> 

It is critical to audit the entire site to ensure that every page includes this tag. Otherwise, you can’t ensure that you’re tracking all your traffic.

For complex sites with multiple templates and different applications, it is easy to miss tagging sections of the site entirely. Commonly overlooked areas include pop-up windows, microsites, third-party sites, and custom applications. Make sure you have a development workflow that ensures that new pages are always getting tagged.

Be first to the party…and bring cookies

This client-side tagging uses cookies to identify each unique visitor and tie data to user sessions. It is important to ensure that your chosen tracking solution sets a first party cookie associated with your domain, and not a third party cookie associated with someone else’s.

Advertising networks such as DoubleClick generally set cookies associated with their domains, even though they’re created on your site. In the same fashion, hosted analytics services typically offer third-party cookies as the /files/includes/default.css option. Most hosted analytics services now offer methods to provide first-party cookies.

To combat users’ privacy concerns, many browsers now give the option to block these third-party cookies entirely, which can significantly decrease the accuracy of your reports. First-party cookies, on the other hand, are more widely accepted, and can provide you with the data you need for analysis. It’s important to ensure that your web analytics solution uses them, even if you are using a hosted analytics service.

Think of your web pages as snowflakes—Each is unique.

Web analytics track visitors by examining the different pages they visit on your site. In order to have accurate and meaningful statistics, the software must be able to identify each page uniquely. Database-driven dynamic pages can present challenges in this regard. By running many pages through a single template, you can lose insight into path analysis, content groups, and conversion objectives.

Luckily, many web-analytics tools are sophisticated enough to identify URL parameters and recognize them as unique pages. If you have already selected a web analytics tool, it is essential to review its capabilities and requirements for tracking dynamic pages.

There are several programmatic solutions to these problems:

  • Use a server-based URL rewrite method to display your dynamic URLs as unique static pages. On Apache, mod_rewrite is a widely used solution for this problem, which makes it fairly easy to map URLs such as “” to a clean URL such as “”. Creating these friendly URLs is more work up front, but can pay dividends for analytics, as well as for search engine optimization.
  • Make sure each template-driven page has unique parameters in the URL. Some web applications will run everything through a single URL with the exact same parameters. For example, if you have a multi-step form driven from the same page template, be sure that there are unique url parameters such as “step=1” that identify each unique step for tracking.
  • Configure web applications to dynamically set custom variables at the page level. Sometimes, you are limited in your ability to change the URL structure or set new URL parameters. Many advanced analytics tools allow you to set custom variables in the code as meta tags, or within the analytics JavaScript tag itself. The Google Analytics code from earlier is a simple example of this, as you see that it uses a tracking number to identify your site from all the others that it tracks.

Content management systems—Analytics friend or foe?

Many sites today are driven by content management systems (CMS), which allow non-technical users to create and manage content.

Integrating your analytics data collection into your CMS is one of the single biggest opportunities to streamline and automate your reporting. Site tagging and measurement should be a byproduct of your content publishing process. Here are a few examples:

  • Content Groups: Analytics tools can organize individual pages into higher level user-defined groups. As you plan the content organization for your website and set up a CMS, align each content area to the desired analytics content group. You can then extend the CMS to automatically set the appropriate content group tags on each page. As new content is added, the content groups are dynamically added and fed directly into your reports. This is an elegant solution which reduces ongoing tagging work and can make grown analysts weep for joy.
  • Page Titles: Most reports use the contents of the HTML <title> element as the name of the page. However, page titles are often completely meaningless and fail to provide context to the content of the pages. Most analytics solutions support alternative page titles, so simply add a field in your CMS which asks for a meaningful page name, and program your site to add it into the template. As content contributors add content, those page names will be automatically associated with each page, which is a big win.
  • Custom Metadata: There are often additional types of data in a CMS that describe content. For example, Digital Web Magazine may want to track the popularity of specific authors across its site. Because authors can belong to multiple content groups, a custom variable can be set on each page which identifies the author and feeds into a specific report. The data has already been defined and the CMS can be extended to include it in the template. As new authors are added, pages are automatically tagged and fed directly into the reports.

By automating the tagging process and integrating it with your content-publishing workflow, you can streamline the reporting process and save significant time and energy along the way.

Onsite searching

If your site has a search engine, it is important to be able to report on user search queries and the number of results for each search. When configuring your search application, make sure the search query and number of results is a visible parameter in the results string. For example, if a user searches for “web analytics” on Digital Web Magazine, the URL looks like:


This enables a report to be configured which measures top site searches. If this is not possible with your search engine, you may need to set the values as custom variables on the results page.

Additional considerations

Other things to keep in mind include:

  • File downloads such as PDF and Word documents are not typically tracked with client-side tagging. It may be necessary to add custom code to the links in order to accurately track downloads.
  • Flash and AJAX interactivity is not based on unique page views, and can be a measurement black hole. However, it is possible to track them with some additional development work and a little more upfront planning. Evaluate how and why you are using these technologies, and understand the measurement trade-offs.
  • E-commerce applications, like content management systems, need to be configured to allow key variables such as product IDs, cost, units, and commerce checkout steps to be tracked correctly. Be sure your developers understand the tracking requirements. Without a properly configured e-commerce application, you will lose valuable data regarding sales and shopping cart abandonment.
  • Use common names and values that can link online and offline data. For example, instead of setting an arbitrary product ID number, use the SKU from your inventory system. Set customer identification numbers that match the ones used in your customer relationship management system. This can enable you to merge data and correlate online and offline reports for advanced analysis.


If you are in the position of redesigning your site or changing the technology platform, be sure to get your measurement and technology teams together early and often. The above considerations are some of the common trouble spots, but remember that these are simply technology challenges. Solving them doesn’t replace the need for a well thought out measurement strategy. While it may take a little bit more time up front, getting it right the first time is far easier than going back later (or worse, never at all) to reconfigure your site architecture.

Related Topics: Web Analytics, Search

Jeff Cram co-founded ISITE Design in 1997 and is Managing Director of the Boston office. Jeff is a frequent speaker at national conferences on topics including web analytics, search engine marketing and web usability. When not helping organizations on the web, he enthusiastically roots for the Boston Red Sox from his home in Cambridge, Massachusetts.