A connecting script is a script (JavaScript) that connects an OJS journal and OJStat. The script must be placed on the journal header so that every time the journal pages load it sends data to OJStat to record.

The script contains three variables that hold particular "functions":

  1. ojSiteId: functions as the journal identity in OJStat. The value of this variable is automatically generated based on the siteId of the journal in OJStat (not in OJS).
  2. ealink: functions to read the current URL of the journal (in OJS). This variable parses the URL to decide what JavaScript files to be called since OJS pages are located in different paths and depths.
  3. eajs: functions to create a script element, set attributes to the element, and append the element to the journal header (in OJS).

The script must be directly copied from the Journal Settings Page in OJStat since different journal has different ojSiteId. The typical lines of the code is like shown below (taken from OJStat version 1.3):

<script>var ojSiteId=1,eainlink=window.location.href,eajs=document.createElement("script");0<eainlink.indexOf("issue")||0<eainlink.indexOf("view")||0<eainlink.indexOf("about/")?eajs.src="../../../../ojstat/OJStat.js":eajs.src="../../ojstat/OJStathome.js";eajs.setAttribute("async","async");document.head.appendChild(eajs);</script>

Pay attention that the ojSiteId in this example is 1 while yours may be different.

This code, taken from the Journal Settings Page in OJStat, must be copied in the respective journal header in OJS. Users must login to the journal (in OJS) as a journal editor or manager or administrator and find Custom Tags box under Settings->Distribution->Indexing. The script must be placed at the top line in the box and then save changes.

Detailed instruction about connecting OJStat with journal in OJS can be found in the Journal Settings Page in OJStat. It is important to remind that whenever a journal is closed in OJStat, this connection script must be removed from the respective journal header in OJS.