This article and the following four will discuss a file that is vital for Adobe Analytics: the
Note: technically, this article is completely outdated. You should not have to read this if you are implementing a fresh site. I’d even say that you do not have to know what
s_code.js is at all.
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.
s_code.js file contains 4 parts:
- a section with configuration variables,
- the definition of a useful callback method called
- space for defining “plugins“, and
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.
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:
- Use Adobe Tag Manager which can automatically update it for you, or
- 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!
40 thoughts on “The s_code.js File – Overview”
Thanks Jan, A really useful overview… eagerly awaiting the next articles in the series.
Thanks Billy, we’ll do our best!
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!
We’ll have a post on Tag Manager 2.0 this month or possibly early August.
But for your question we’d refer you to http://microsite.omniture.com/t2/help/en_US/sc/implement/index.html#Legacy_Implementation_to_Tag_Mapping. There’s a good paragraph for plugins in there.
how to identify the cookies used in s_code
There are some cookies that the Experience Cloud Solutions set automatically. You can find them here: https://marketing.adobe.com/resources/help/en_US/whitepapers/cookies/, or, for Analytics, here: https://marketing.adobe.com/resources/help/en_US/whitepapers/cookies/cookies_analytics.html
Does that help?