This article and the following four will discuss a file that is vital for Adobe Analytics: the
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!