The s_code.js File – Overview

This article and the following four will discuss a file that is vital for Adobe Analytics: the s_code.js file.

We’ll explain what it does and why you need it. We’ll tell you what you have to configure inside the file. We’ll also give you some tips around using it to make your life easier.


The s_code.js file contains 4 parts:

  1. a section with configuration variables,
  2. the definition of a useful callback method called s.doPlugins(),
  3. space for defining “plugins“, and
  4. the core Javascript code that defines how Adobe Analytics works in the browser.

The s_code.js File
The first section is about configuration. Line 10 is the most important part, it tells the system where the tracking should go, into which “report suite” (think of it like a database).

We’ll get to the concept of a repoert suite and to the other settings in a separate post.

The second section, from line 30 – 50 in the screenshot, contains the definition of the s.doPlugins() callback method.

We’ll get to it later as well, as it is a) really important and b) allows you to automate a lot of your tracking.

For now we’ll just mention two things:

The callback will be executed whenever a tracking call is sent to the Adobe servers, just before it is actually sent. So, when you call s.t() somewhere on a page, the system collects some data, then calls s.doPlugins() and then sends everything off.

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!

The third section, from line 51 – 132, contains the definition of the plugins we use in s.doPlugins(). Some of these you get from your Adobe consultant during implementation. Some of them you can download from the Adobe knowledgebase, and some even float around on the Internet. You can even write plugins yourself, of course!

Lines 134 – 138 contain more configuration. This bit you will probably never touch.

Everything down from line 140 to the end is the core Javascript library code. Again, you would probably never touch this.

How do I get the file?

You can get the s_code.js file in two different places: 1. from the Adobe consultant who helps you with the implementation, and 2. straight out of the SiteCatalyst Admin interface.

The former will likely have plugins added whereas the latter won’t.

It usually makes more sense to use the code that the consultant gives you. But there are exceptions, the most important one being when you want to update the core JS library to the latest version.

The official way of getting the latest code has two flavours:

  1. Use Adobe Tag Manager which can automatically update it for you, or
  2. Download the latest version from the SiteCatalyst Admin UI, then transfer your plugins and other customisations over into the new file.

The unofficial, simpler way is to just take all the code below line 140 (or whereever the core JS starts in your file) from the new file into your existing s_code.js file. Works a treat.

Make sure you test before you put the new s_code.js file live!

So much for now, look for the other four articles over the next couple of days!

36 thoughts on “The s_code.js File – Overview

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

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

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

  4. Pingback: The s_code.js file – Core Javascript Code | Web Analytics for Developers

  5. Pingback: Debugging | Web Analytics for Developers

  6. Pingback: Basic Tracking | Web Analytics for Developers

  7. Pingback: Finding a ‘Report Suite ID’ | Web Analytics for Developers

  8. Pingback: Tracking Mobile Apps | Web Analytics for Developers

  9. Hi Thanks for the post. When using Tag Manager 2.0, is it necessary to paste in the plugins? And where do they go? I can’t seem to get my plugins to ‘fire’ on ATM 2.0.

    Thanks – any further posts/discussions on ATM are welcome and appreciated!


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

  11. Pingback: Tracking w/o Javascript | Web Analytics for Developers

  12. Pingback: How Do I – Track Page Load | Web Analytics for Developers

  13. Pingback: “Data Layer” Tips | Web Analytics for Developers

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

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

  16. Pingback: s_gi() and Tracking Links | Web Analytics for Developers

  17. Pingback: How to Use Merchandising Variables | Web Analytics for Developers

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

  19. Pingback: Getting into Analytics in 1 Hour | Web Analytics for Developers

  20. Pingback: Page Views | Web Analytics for Developers

  21. Pingback: Tagging Forms (w/o Losing Money) | Web Analytics for Developers

  22. Pingback: With DTM you don’t need Plugins! – Part 1 | Web Analytics for Developers

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

  24. Pingback: Internal URLs | Web Analytics for Developers

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

  26. Pingback: TDD and Adobe Analytics | Web Analytics for Developers

  27. Pingback: Basic Tracking – Remix (contains DTM) | Web Analytics for Developers

  28. Pingback: When exactly does doPlugins run? | Web Analytics for Developers

  29. Pingback: Everything but the TMS | Web Analytics for Developers

  30. Pingback: Tracking Versions | Web Analytics for Developers

  31. Pingback: 2016 for Developers | Web Analytics for Developers

  32. Pingback: Cookies, IDs, and the Experience Cloud – Web Analytics for Developers

  33. Pingback: 2017 for Developers – Web Analytics for Developers

Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.