Basic Tracking

Most web analytics data is gathered within browsers using Javascript. There’s other ways, but we’ll get to that later.So how do you track a web page?

(Too) Minimal Code

The very minimum are 4 lines of code, like so:

<script type="text/javascript" src="/include/s_code.js"></script>
<script type="text/javascript">
s.t();
</script>

The first line loads the s_code.js file which contains three important pieces (we’ll go into that later).

For now, suffice to say that it defines the s.t() method which is called in the third line. The s.t() method is what actually triggers the tracking of the page.

The 4 lines above work, but they won’t produce good reports. One crucial bit is missing, the s.pageName variable.

Content in Adobe Analytics is identified not by the URL but by the s.pageName. If you’re not sending anything in that variable, the system will revert to using the URL, but your reports will look like this:

Can anybody tell me which page “site.com/?id=987654321” refers to? Unlikely.

So let’s improve our code!

(Better) Minimal Code

Let’s add one line to turn it into something usable.

<script type="text/javascript" src="/include/s_code.js"></script>
<script type="text/javascript">
 s.pageName="Testpage";
 s.t();
</script>

So what do you put into the s.pageName variable on a given page?

The answer to that depends on your site, your marketers and possibly your CMS. In general, the name should follow the “three Cs”: context, concise, complete.

My suggestion would be to run it by the marketer. The ultimate test is to fake a report with a couple of names, show it to them and see whether based on the name they know whcih page you are talking about. If they do: good name!

What do you get?

With the minimal code you will get a bunch of built-in reports along with all the traffic metrics: Page Views, Visits, Visitors. You also get pathing reports like “Next Page Flow” and even geo segmentation if that’s enabled for the report suite.

This is the level of tracking that most people will easily understand: you can look at trends (did we have more or less traffic? From more or less Visits or Visitors?) and rank your pages (“Oh, the campaign landing page really took off this month! See, it passed the home page in popularity!”) as well as find out where your visitors went after the landing page.

Minimal Useful Code

I will come back to the subject traffic metrics at some point, let me just say for now that I think web analytics should go a lot further than Page Views. Minimal code will get you minimal results.

The next step is to track “micro conversions” on the site, i.e. activities done by the visitors which we (the marketer) deem important. That could be buying something, looking at a product, downloading a white paper, signing up for a newsletter or searching.

Most sites do not just exist in a void. They have a specific purpose. Micro conversions are like little steps on the way there and tracking them allows us to see how far visitors go down the path to conversion.

Adobe Analytics has space for up to 100 micro conversions in the s.events variable. The events are called “event1” to “event100”. Your marketer (or an Adobe consultant) will define which one is which. They might give you a “Solution Design Reference” or “Tech Spec” document that includes the mappings.

So let’s look at an example.

Our site contains a blog and our marketing department wants to get a more detailed look at article consumption. The “Tech Spec” tells you that “event21” should be “Blog Article Views”.

The code on the article about “Basic Tagging”, which is the 2nd blog article on the site, might look like this:

<script type="text/javascript" src="/include/s_code.js"></script>
<script type="text/javascript">
 s.pageName="Blog:b2:Basic Tagging";
 s.events="event1,event21";
 s.t();
</script>

We added two events here: event1 (“Page Views (custom)”) and event21 (“Blog Article Views”). The “Blog Article Views” metric is already a step forward because in a lot of cases it will be more relevant than “Page Views”.

We have also entered the world of conversion metrics and variables, which we’ll explain later.

For now, our marketers will be able to analyse their campaigns based on “Blog Article Views” rather then “Click-throughs”, which is a huge step.

What next?

We shall go into more advanced tracking in due time so let me just drop a couple of concepts here that I’ll explain later.

We can add “plugins” to the s_code.js file. Those plugins can capture data independently of page code (i.e. on every page on the site). Good examples would be: capture campaign tracking codes, visit number, time of day, days since last visit, marketing channel and much more.

Once we talked about SAINT and classifications, you’ll see how classifying some of the data can produce much better reports. We’ll essentially add meta data to our reports to make them ore readable or to aggregate data.

That’s it for now, really.

Apart from the s.pageName variable, everything so far can easily be done in the template if your CMS works with templates. That makes your job a lot easier

About

German expat living in Switzerland (formerly UK and France). Consultant and member of the Multi-Solutions Group at Adobe, working with the Digital Marketing Suite. Father of 4 girls.

Tagged with: ,
Posted in Javascript, Page Code
24 comments on “Basic Tracking
  1. […] Example: in the screenshot we assign s.campaign on lines 32 – 36. This allows us to pick up tracking codes for campaign tracking anywhere on the site without additional code on any page! […]

    Like

  2. […] s.tl are defined here, the two methods that you use to actually send tracking information. We have introduced s.t and will discuss s.tl at some […]

    Like

  3. […] Let’s run through an example. Take the following code on a sample page: […]

    Like

  4. […] far we have shown you how you can track web pages and how you can send custom data when doing that. Today, we introduce two features that let you […]

    Like

  5. […] we can see looking at the tracking call in a debugger, this call transports the pageName, props, eVars and three events ‐ prodView, event2 & event12. As an example, let’s look […]

    Like

  6. […] far we have explained what basic tracking of web pages looks […]

    Like

  7. […] Analytics provides out-of-the-box “variables” for tracking purchases. Let’s take the example from our post about basic tracking and amend […]

    Like

  8. […] have introduced the principles behind basic tracking of a web page. We have also discussed how to go further. Today, we will look at tracking “the […]

    Like

  9. […] look back at the simple example we used to explain basic tracking on a web site. We proclaimed that reasonable tracking should at least contain s.pageName and at […]

    Like

  10. […] we’ll focus on the differences between tagging a web page (see Basic Tracking) and tagging an app (see Tracking Mobile […]

    Like

  11. […] Almost all web analytics tools these days are tracking using Javascript in the browser, see the post about Basic Tracking. […]

    Like

  12. […] “normal”, Javascript-based tracking (plus plugins), tracking w/o Javascript, tracking links & actions, tracking apps, Context […]

    Like

  13. […] you’ll need to track some more than s.pageName to be able to answer non-trivial questions, but there are only three basic techniques for how you […]

    Like

  14. […] sub tab, to see what “variables” the tracking call contains. In the screenshot, we see s.pageName (set to “home”), some events, props and eVars. We even see some Dynamic Variables […]

    Like

  15. […] you track page load, you would send the “section” that describes where the page sits in the site. On […]

    Like

  16. […] You assign values to “Variables” for basic tracking […]

    Like

  17. […] for a change). Then I’d tell you what you really should put into the code (a bit like the Basic Tracking article does). The last article would be about debugging your […]

    Like

  18. […] a bit further up the “this is useful” scale as the vary basic tracking I wrote about in Basic Tracking. What I’m trying to say is: we probably need […]

    Like

  19. […] systems use the browser to track activity. Javascript on the pages will create a “tracking beacon”, essentially a GET request with various parameters in […]

    Like

  20. […] assign a name to the page. Finally, still within that <script> block, you’ll call the s.t() method, which sends off the image […]

    Like

  21. […] can see that for Adobe Analytics, DTM defines that the Page Name (the most important attribute for a page, no less) should be set to “%Page […]

    Like

  22. […] March 2013, I wrote an article on Basic Tracking, showing you the minimal set of code on a page that is needed for tracking the page in Adobe […]

    Like

  23. […] I used to work with Analytics mainly by embedding Javascript into pages (much better!), setting s.products was no different from setting any other “variable“. […]

    Like

  24. […] At the bottom of the page, I add some JS code. All I want is set a page name and a minimum of other things. […]

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Enter your email address to follow this blog and receive notifications of new posts by email.

Join 1,398 other followers

%d bloggers like this: