The s_code.js file – Core Javascript Code

This article is part of the mini series about the s_code.js file. You can find the other articles here:

Core Javascript Code

The biggest portion of the s_code.js file is the core Javascript code underneath the “DO NOT CHANGE” line.

In this part of the file, all the important client-side functionality of Adobe Analytics is defined. The “s object” creation method s_gi is declared along with a couple of helper methods.

Most importantly, s.t and 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 point.

A big part of the code handles setting of the so-called “automatic variables”.

If you check with a debugger, you will notice that tracking calls actually contain a lot more than the data you set:

Data points like screen size (URL parameter “s”), browser width and height (“bh” & “bw”), colour depth (“c”), Javascript version (“j”), local time (“t”), the URL of the page (“g”) and others are automatically appended.

Depending on what browser you are using, you might see more parameters.

Netscape-based browsers send a list of installed plugins in the “p” parameter, while IE sends things like connection speed (“ct”) and whether the current page is the home page (“hp”). How useful those measurements are is a matter of discussion…

Closing Thoughts

The s_code.js file is the heart of all Javascript-based, client-side tracking in Adobe Analytics.

It does the heavy-lifting you’d expect from a library. It handles automatic variables. It provides the “s object” container that allows you to store data for transfer. It also provides you with methods to send that data.

On top of that, it contains the very useful s.doPlugins call back method, which allows you to handle everything that has to be done across the whole site in a central place.

The s_code.js file truly is the most important piece in the whole tracking picture.

Now having said that, we hope that in the future it won’t be.

Two reasons:

  1. The file really has two broader purposes, and those should be separated.
  2. Tag Management is on the rise, fortunately.

We can broadly group the four parts of the s_code.js file into two: core Javascript code versus the rest.

The core Javascript code gets an update every now and again. Adobe Engineering is driving these updates. While a year ago or so they shipped version “H.24.2”, we are now on version “H.25.4”.

Note: there is a change log available for the core Javascript code.

The rest of the s_code.js file will be updated by you or other implementers.

That raises an obvious question: how to easily integrate?

We will post an article on best practise, but for now let’s just say it would be easier if those two groups would be separate.

Secondly, tag management systems are more and more powerful and more customers are using them for convenience and sometimes enhanced functionality.

It makes a lot of sense to put at least some of the four sections that currently sit inside s_code.js into a tag management system instead.

So there you have it, our mini-series on s_code.js concludes. Please feel free to post any questions or remarks in the comments below this or the relevant posting! We’d love to hear from you!

21 thoughts on “The s_code.js file – Core Javascript Code

  1. Pingback: The s_code.js file – Plugins | Web Analytics for Developers

  2. Pingback: The s_code.js file – s.doPlugins() | Web Analytics for Developers

  3. Pingback: The s_code.js file – Configuration | Web Analytics for Developers

  4. Pingback: The s_code.js File – Overview | Web Analytics for Developers

  5. Pingback: “Variables” | Web Analytics for Developers

  6. Pingback: Dynamic Variables | Web Analytics for Developers

  7. Pingback: Debugging – the URL | Web Analytics for Developers

  8. Pingback: Migrating to Tag Management | Web Analytics for Developers

  9. Pingback: Versioning Your Tracking | Web Analytics for Developers

  10. Pingback: Data Centres | Web Analytics for Developers

  11. Pingback: The s.abort Flag | Web Analytics for Developers

  12. Pingback: How to track the ‘Like’ button | Web Analytics for Developers

  13. Pingback: Ode to Charles & Map Local | Web Analytics for Developers

  14. Pingback: Know Your Version | Web Analytics for Developers

  15. Pingback: A Short History of Processing a Hit | Web Analytics for Developers

  16. Pingback: Visitor IDs & Visitor Profile | Web Analytics for Developers

  17. Pingback: The Visitor ID Service | Web Analytics for Developers

  18. Pingback: Analysing Mobile Apps – Debugging | Web Analytics for Developers

  19. Pingback: Quick Tip – One s_code.js for Multiple Sites | Web Analytics for Developers

  20. Pingback: Internal URLs | Web Analytics for Developers

  21. Pingback: The s_code.js File – Where is it now? | Web Analytics for Developers

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