Link

Page Tracking setup

Insert in every web page head (just before the closing </HEAD>; tag) the following Javascript tracking code

<!-- squidanalytics tracker (v1.8) -->
  <script type="text/javascript">
    var sqtrkq = sqtrkq || [];
    (function() {
      var sqtrk =
      document.createElement('script');
      sqtrk.id="sqtrk"; sqtrk.type =
      'text/javascript'; sqtrk.async = true;
      sqtrk.src = (("https:" ==
      document.location.protocol) ? "https" :
      "http")+"://aws.tracker.squidanalytics.com/js/t
      racker.js";
      var selm =
      document.getElementsByTagName('script')[0];
      selm.parentNode.insertBefore(sqtrk, selm);
  })();

<!-- Mandatory parameters -->

  sqtrkq.push(['wid', '...']);
  var u = new URI(document.location.href);
  sqtrkq.push(['dom', '.' + u.domain()]);

<!-- optional parameters, to be call if relevant -->
  sqtrkq.push(['uid', 'userId or AccountId for  example']);
  sqtrkq.push(['post', true|false]);
  sqtrkq.push(['ext', encodeURIComponent(jsonString)]);

<!-- Call to the tracker -->
  sqtrkq.push(['track']);
  </script>
<!-- end squidanalytics tracker -->

This tracking code must be configured:

wid : site account id (provided by squid): different ids for prod, preprod or dev sites to be requested to Squid
dom : the domain to track users on. Typically, this should be your primary domain name prefixed with a dot (ex: ".squidsolutions.com ") which will track users on all your subdomains . Leaving it blank will restrict the tracking to the current subdomain where the page was loaded from, & generate single event sessions. We use the library URI.js to get this domain, in the code above
uid : (optional) user id (you may put here an id associated to the current logged user)
post : (optional) true or false to enable POST requests (handling large requests data). Default is false
ext : (optional) an extra field used to pass extra information to our tracker, preferably a set of key-value pairs sent as a json string or as a URL query string, URI encoded

Automatic Page tracking

Adding this tag in every page, & last, pushing 'track' generates a tracking event, considered as a page display.

Use of extra fields

Examples use of extra fields: categorize pages, give context additional information (account, content, interactions). Please refer to the tracking rules below for normalized information codes

Handling Ad-Blockers

Ad-Blockers are more & more used & most popular ones block by default our tracker. A good way to bypass these restriction is to reverse proxy our 2 resources tracker.js & t.gif between a domain you hosts & our tracker domain aws.tracker.squidanalytics.com
Please find a sample configuration to be added in a vhost on Apache:

Setting the configuration (Apache)

SSLProxyEngine On
SSLProxyCheckPeerCN on
SSLProxyCheckPeerExpire on
RemoteIPHeader X-Forwarded-For
ProxyPass "/js/tracker.js" "https://aws.tracker.squidanalytics.com/js/tracker.js"
ProxyPass "/t.gif" "https://aws.tracker.squidanalytics.com/t.gif"

Once this has been added to the vhost config, please release it (shell commands):

Activate configuration

a2enmod proxy_http ssl remoteip
service apache2 restart


Implementation

Modify the variable sqtrk.src in the script above accordingly to uses the domain configured for your vhost defining the reverse proxy

Event Tracking setup

In addition of the above code, you can implement event based tracking (panel activation, click event, redirect) by adding following type of function & calling it during clicks processing or other interactions you would like to record

JavaScript

<!-- squidanalytics tracker (v1.8) -->
<script type="text/javascript">
function sqclick(data) {
    try { 
<!-- Generate a json string giving event details-->
      jsonString = ...
      sqtrkq.push(['event', encodeURIComponent(jsonString)]);
    } catch (err) {}
}
</script>
<!-- end squidanalytics tracker -->

jsonString: used to pass event information to our tracker, preferably a set of key-value pairs sent as a json string.

Event tracking vs Page tracking

Pushing 'event' generates a tracking event. Without setting the element 'mut' in the jsonString, (see Tracking rules), this hit is counted as a page display event. Please take this in account if you want to consider an event also as a page load or not.
Also don't forget to setup 'mact' element to indicates what is the interaction you want to record
You should also recall any other element provided at page load (page classification, content, etc ...) so the whole context is recorded in the event

Tracking Pixel Setup

In the case of a non Javascript environment (Mobile app, AdServer creative, Emailing....) a "pixel" version of the tracking code is available :

HTML

<img width="1" height="1" src="//aws.tracker.squidanalytics.com/t.gif?wid={wid}&uid={uid}&bid={bid}&sid={sid}&ref={ref}&url={url}&ext=noscript&ext={ext}" />

Configure the tracking code :
wid : site account id (provided by squid)
uid : (optional) user id (you may put here an id associated to the current logged user)
bid : browser id (less than 37 chars) - it is the unique browser identifier used to track all visits.. (optional).
sid : session id (less than 37 chars) - it is the unique session identifier used to track all session interactions. (optional).
ref : referring page url (url-encoded) (optional)
url : current page url (url-encoded) (optional)
ext : extra parameters. if a "noscript" value is set, 3rd-party cookie tracking will be enabled (optional)

Notes

Third-party tracking

3rd-party cookies must be used when performing cross-site tracking.

For instance when the tracking pixel is used to track creatives served by an Ad-Server, only 3rd party cookies can be used since the page where the pixel is displayed is on an external domain.

By default 3rd-party cookies are created on our .squidanalytics.com domain.

Should this cause data confidentiality issues, we may be able to create them on a specific 3rd-party domain by setting-up a DNS alias on a custom sub-domain, so that our tracking infrastructure is seen as being part of the .3rdparty.com domain and thus is able to create cookies on this domain.

In that case the tracking pixel would turn to :

HTML

<img width="1" height="1" src="//tracking.3rdparty.com/t.gif?wid={wid}&uid={uid}&bid={bid}&sid={sid}&ref={ref}&url={url}&ext=noscript&ext={ext}" />

Limitations

3rd-party cookies are not enabled by default on Safari-based browsers. Therefore when such a browser is detected by its user-agent string, we will not enable the 3rd-party tracking.

Also Ad Blockers are removing our third party cookies

Tracking rules

In order to avoid double counting, it is recommended to call the method sqtrkq.push in the following cases only

  • Page load: When the page load, call sqtrkq.push(['track']) once only. This will log a record. All mandatory & optional parameters (wid, dom, ext, ...) must be pushed before the track call

  • User interaction: When a user interact with a page & you want to record this activity, you have to call sqtrkq.push(['event',... to log this record. Doing that on user activity avoids to track technical artefact. User activity can be a click, opening a popup or panel, etc, etc.

It is important to record using the ext field any valuable information that can’t be parsed from the url and/or the referrer.
Here is a proposed list of tags to be implemented in this field when information is not available through URL or Referrer fields:

urlCategory

Tag Name

Description

Purpose

Content pages

cid

Content identifier

Usage
Counter

Content pages

citid

Content item id (ex: an journal article id or book chapter, or track id ...)

Usage
Counter

Content pages

cent

Entitlement path from the user to the content if paid. It can be the subscription id or the account id paying for it, leave blank if anonymous usage

Usage
Counter

Content pages

ccid

Content Collection id if exists (group of products)

Usage
Counter

Content pages

cdid

Database/product bought it comes from (useful to indicates what is the database when content linked to many)

Usage
Counter

Content pages

cdt

Content display type (Video, Abstract, Citation, HTML, Image, ...)

Usage
Counter

Content pages

ctid

Content Type (Book, Journal, etc)

Content pages

sid

Search id it comes from (see transaction ID in misc)

Usage
Counter

Content pages

cgoa

Gold Open Access flag

Counter

Content pages

ctu

Turnaway category

Counter

Content pages

car

Backfiles/archived content flag

Counter

Content pages

cpid

Content publisher Id (content can be published by several)

Usage
Counter

Content pages

caip

Article in Press flag

Counter

Miscellaneous

mpid

Platform Id

Usage
Counter

Miscellaneous

mtip

Transaction Id (Page ID), unique transaction id server side
Multiple pages from the same search should have the same transactionid as it comes from the same search recall)

Usage
Counter

Miscellaneous

mpa

Page classification (Content, Search, Browse, Transaction, Home, About...). This has a direct impact on what is counted where in Inkwell apps

Usage
Counter

Miscellaneous

mpsa

Page sub classification: own site page categorization

Usage

Miscellaneous

mvan

Current navigation path used on the site

Usage

Miscellaneous

merr

Error flag (a code indicating a type of error: during login, transaction ...)

Usage

Miscellaneous

maid

Account ID viewing the content

Usage
Counter

Miscellaneous

maut

List of authentication methods (IP/LOGIN/SSO or a combination of these)

Usage

Miscellaneous

mact

Action on page (reference, citation, outlink, click, record_view, addtobasket, removefrombasket, payment, payment_ack, ...)

Usage
Counter

Miscellaneous

mdid

destination: Content id/page id(or url if outlink)

Usage

Miscellaneous

mut

Usage type: page (so counted as a page hit), event (so not counted as a page hit).

Usage
Counter

Miscellaneous

mcz

Zone in the page of the interaction (toolbar, left or right panels, menu bar, position of an result list item ...)

Usage

Searches

spn

Page number selected in the search result

Usage

Searches

ssst

Sort type selected

Usage

Searches

ssos

Sort order selected

Usage

Searches

sst

Search Terms

Usage

Searches

sse

Search Engine (basic, advanced, ...)

Usage

Searches

srs

c.srs for search result size

Usage

Searches

sfu

List of Facets used in search

Usage

Searches

scid

List of collections searched

Usage

Searches

sdid

List of databases searched, with owner id

Usage
Counter

Searches

sfe

Federated search flag

Usage
Counter

Transaction

tbid

Basket Id for back office reconciliation

Usage

Transaction

tcid

Content id (or item)

Usage

Transaction

tit

Number of items involved

Usage

Transaction

tpi

Price of the item

Usage

Transaction

tca

Rebate amount on the item

Usage

Transaction

gra

Global rebate amount

Usage

Transaction

tvc

Voucher code used

Usage

When information is available in the URL or the referrer, the corresponding tag can be skipped, it will be extracted from these fields with the help of regexp. The customer has to inform Bouquet.ai which & where the information is located inside the referrer and/or the URL