Smartocto Insights script (former Content Insights) is a component used to track the historical data (at least 24 hours old), while the Tentacle script is used for real-time tracking and A-B testing.

If you run a WordPress site, read how to download and install our plugin.

Smartocto Insights' (CI) tracking code is a piece of JavaScript code that will send information about your articles and reader behaviors to the CI servers.

Detailed and customized instructions are sent to each client once they agree to test CI on their site.
The specifics of configuration for your domain can always be found in the application, under Settings → Tracking code.
CI tracking code is asynchronous and it will not affect the speed of the website.

Before you start

  • The code should be put only on article pages.
  • It shouldn’t be on the homepage, category/tag/sections pages, etc.
  • Make sure that your CMS does not load the tracking code in the preview mode or on any temporary pages.
  • A proven best practice is to omit our code when staff members are logged in. Be careful not to omit the code from all logged-in users if you have a subscription system or any other option where you allow your readers to register on your website.
  • If you have a staging/test server please let us know and we'll assist you.
  • The basic principle of the JavaScript tracking code is to search the page for the global _ain objects and to send information found in that object to the Smartocto Insights servers.
  • Setting up a tracking code means making sure that _ain object is populated with the correct metadata about the article.

Code snippet

This is an example of an empty tracking code that you should put on every article page. It should contain your domain ID.

<script type="text/javascript">
/* CONFIGURATION START */
var _ain = {
  id: "DOMAIN_ID",
  postid: "",
  maincontent: "",
  title: "",
  pubdate: "",
  authors: "",
  sections: "",
  tags: "",
  access_level: "",
  article_type: "",
  reader_type: "",
  social: {}
};
/* CONFIGURATION END */
(function (d, s) {
  var sf = d.createElement(s);
  sf.type = 'text/javascript';
  sf.async = true;
  sf.src = (('https:' == d.location.protocol)
    ? 'https://d7d3cf2e81d293050033-3dfc0615b0fd7b49143049256703bfce.ssl.cf1.rackcdn.com'
    : 'http://t.contentinsights.com') + '/stf.js';
  var t = d.getElementsByTagName(s)[0];
  t.parentNode.insertBefore(sf, t);
})(document, 'script');
</script>


You can set this up however you like. It can be put directly on the page, it can be part of some JavaScript file that you already have or it can be set through Google Tag Manager.

If you put this code into some library on your page, make sure that the _ain object is globally accessible.
This can be achieved by declaring it somewhere in the global scope before populating it in the library.


Parameters

url (optional)
In most cases, sites use canonical URLs so you don’t have to specify this parameter, the tracker will add it automatically.

<link rel="canonical" href="https://contentinsights.com/blog/changing-the-way-we-approach-editorial-analytics/" />

If your site doesn’t have canonical links or og:url parameters, please specify it manually.
It needs to be a full URL, with the domain, like this:

url: "https://contentinsights.com/blog/changing-the-way-we-approach-editorial-analytics/",


It should be a unique, canonical link to the article.
Having variations in the URL of the same article can cause problems in calculations later.

id (required)

The domain ID is a 4-digit number automatically created by the CI application after the domain registration.
You can always see it in the application URL, it's "1234" in this example:

https://app.contentinsights.com/1234/overview

postid (required)

Post ID is a unique identification of the article. We will combine all the statistics for the articles with the same postid.
It doesn’t need to be numerical. You can use article ID from the CMS, slug, even the whole URL.

For example, WordPress sites have a shortlink tag with post ID:

<link rel='shortlink' href='https://contentinsights.com/blog/?p=123' />

In this case, postid parameters should have this value:

postid: "123"

IMPORTANT: postid value will always be converted to a lowercase string in our system.

Example: "ABC123" will be stored as "abc123".


maincontent (required)

In Smarocto Insights, we have a metric called Read depth.

To calculate how far through an article a reader got, we look where the content is, calculate its height, count the number of words, and then we measure the time and how far through the user scrolled while reading the article.

All these metrics are then put in the formula that tells us how much of the content is being read by the user for the given time.

To know where the content is so we can count the words and calculate the height and the position relative to the window, we need to know exactly what elements of the page contain the content of the article.

To identify those elements, you must specify CSS selectors of those elements in the maincontent parameter.

Example:

maincontent: "#article-title, .article-body"


pubdate (required)

This is the date when the article is published. It has to be in ISO 8601 format.
Example:

pubdate: "2021-10-23T22:33:44.000+00:00"


title (recommended)

This is a simple article title.

You can use the value from the title or og:title tag, but you should remove the site title if present.

If there are quotes in the title they need to be escaped.

title: "Did you watch new &quot;Star Wars&quot; movie?"


authors (recommended)

This is the author's name or comma-separated list of authors.

If authors sign articles differently each time (e.g. John Smith, J. Smith, J.S.) then it would be best if we find a way to always send us just one version. There is an option in the system to manually group them afterward, but it’s best if the data is clean from the start.

authors: "John Smith"


When multiple authors contributed to the article, it’s important that you send us authors as a comma-separated string. You cannot use a different separator.

Example:

authors: "Jack Black, Jane White"


Our system can work without authors, but valuable insights will be lost.

sections (recommended)

Sections are the primary way of organizing content in Smartocto Insights.

We use sections as containers for comparing one article against each other. This parameter should be filled with a single section, sections with the hierarchy or multiple sections as comma-separated strings.

Sections in a hierarchy usually reflect the site structure, for example:

  • News
  • Sports
  • Life
  • Fashion
  • Entertainment

Sections can be grouped (nested) with the > separator.

For example, if an article belongs to section Football, which is part of the Sport section, you can send us this value:

sections: "Sport>Football"


If the article contains embedded video and, for example, you have Video section, you can send us this value:

sections: "Sport>Football, Video"


tags (recommended)

Values from the tags parameter are called Topics in Smartocto Insights. Just like the sections, it should be a comma-separated string of topics.

tags: "Premier League, Chelsea, Antonio Conte"


access_level (optional)

Represents the article access level type. The value can be one of the following standardized options: “free”, “preview”, “paid”

access_level: "free"

Please read the Paywall setup for further explanation.

reader_type (optional)

Represents the type of visitor/reader currently browsing your site.
The value can be one of the following standardized options: "anonymous", "registered", "subscribed"

reader_type: "anonymous"


Use "anonymous" for all guest visitors, "registered" for registered or logged-in visitors and "subscribed" for subscribed (premium) visitors.

Please read the Paywall setup for further explanation.

article_type (optional)

This represents the type of article as specified by publisher (e.g. "news", "gallery", "blog", "essay").

article_type: "news"

 

social (optional)

Provides an option to include the number of reactions from social networks for the visited article.

At this moment, three properties are supported: Facebook, LinkedIn, and Pinterest.

social: {
  fb_count: "123",
  ln_count: "456",
  pn_count: "789"
}

This parameter should be filled with the latest values for each article visit. 

The existence of parameter for each network will override any other way of collecting data. Our system will always use the value set in the tracking code. This allows for explicit exclusion of one or more networks by setting parameter to "0" always, for each visit. The example below means you don't care about LinkedIn and Pinterest and you only want to send the data from Facebook:

social: {
  fb_count: "123",
  ln_count: "0",
  pn_count: "0"
}

You don't need to use all parameters. This is the example of the full tracking code where you send us information about Facebook data while allowing our system to collect LinkedIn and Pinterest data on its own. Keep in mind that the value for fb_count should be there and updated with each visit:

<script type="text/javascript">
/* CONFIGURATION START */
var _ain = {
  id: "DOMAIN_ID",
  postid: "",
  maincontent: "",
  title: "",
  pubdate: "",
  authors: "",
  sections: "",
  tags: "",
  access_level: "",
  article_type: "",
  reader_type: "",
  social: {
    fb_count: "458"
  }
};
/* CONFIGURATION END */
(function (d, s) {
  var sf = d.createElement(s);
  sf.type = 'text/javascript';
  sf.async = true;
  sf.src = (('https:' == d.location.protocol)
    ? 'https://d7d3cf2e81d293050033-3dfc0615b0fd7b49143049256703bfce.ssl.cf1.rackcdn.com'
    : 'http://t.contentinsights.com') + '/stf.js';
  var t = d.getElementsByTagName(s)[0];
  t.parentNode.insertBefore(sf, t);
})(document, 'script');
</script>

---

If you still have some questions or concerns please contact our Support Team via email: support@smartocto.com