{"_id":"@dicdikshaorg/telemetry-sdk","_rev":"7-0bba791c23959f082f30f35e9b14340d","name":"@dicdikshaorg/telemetry-sdk","dist-tags":{"latest":"1.3.0"},"versions":{"1.3.0":{"name":"@dicdikshaorg/telemetry-sdk","version":"1.3.0","keywords":["telemetry","telemetry library","telemetry-lib","telemetry-library","project-sunbird","sunbird telemetry","telemetry-sdk","telemetry sdk","sunbird telemetry","sunbird-telemetry","sunbird"],"author":{"name":"Manjunath Davanam","email":"manjunathd@ilimi.in"},"license":"MIT","_id":"@dicdikshaorg/telemetry-sdk@1.3.0","maintainers":[{"name":"akash.trigyn","email":"akash.jaiswal@trigyn.com"},{"name":"sayalimore1610","email":"sayali.more@trigyn.com"},{"name":"shailendra123","email":"Shailendra.Pratap@trigyn.com"},{"name":"tejaswini19","email":"tejaswini.giram@trigyn.com"},{"name":"yashveer","email":"yashveer.negi@trigyn.com"},{"name":"dictrigyngroup","email":"Diksha.Leads@trigyn.com"}],"homepage":"https://github.com/dicdiksha/sunbird-telemetry-sdk/tree/master/js#readme","bugs":{"url":"https://github.com/dicdiksha/sunbird-telemetry-sdk/issues"},"dist":{"shasum":"6725a2d223a502cc25091f23411a7ecdba70b528","tarball":"https://registry.npmjs.org/@dicdikshaorg/telemetry-sdk/-/telemetry-sdk-1.3.0.tgz","fileCount":3,"integrity":"sha512-9uFTFfFzN/B8mkhp+E+NUflmJiVH/obteinyVqKtnU34bWfgexyNan93pFsAJsx1oo7r8JNNjfSW1Ml3Lhy62Q==","signatures":[{"sig":"MEUCIBsBn8VQtdaaagTfSlYpyj0FhL+UJwO+Ad/OwB6CBF7zAiEAuXcyVdaRuwi635qupNPHvw6FaALPAIftDATRALQjvAw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":291668},"scripts":{"test":"karma start karma.renderer.config.js","build":"rimraf ./dist && node bundle-schema.js && node buildSDK.js && node_modules/.bin/cpy package.json ./dist && node_modules/.bin/cpy README.md ./dist","codecov":"codecov","test-sdk":"karma start karma.renderer.config.js"},"_npmUser":{"name":"sayalimore1610","email":"sayali.more@trigyn.com"},"overrides":{"graceful-fs":"^4.2.11"},"repository":{"url":"git+https://github.com/dicdiksha/sunbird-telemetry-sdk.git","type":"git"},"_npmVersion":"6.14.16","description":"Telemetry Service javascript library helps to generate the telemetry events.","directories":{"test":"test","example":"example"},"_nodeVersion":"18.20.3","_hasShrinkwrap":false,"devDependencies":{"ajv":"^6.12.6","karma":"^6.4.2","jquery":"^3.7.1","rimraf":"2.6.2","codecov":"^3.8.3","cpy-cli":"^5.0.0","jasmine-core":"3.2.1","karma-jasmine":"1.1.2","karma-coverage":"^2.2.1","karma-junit-reporter":"1.2.0","karma-mocha-reporter":"2.2.5","karma-chrome-launcher":"^1.0.1","karma-jasmine-matchers":"3.8.3","karma-verbose-reporter":"0.0.6","karma-phantomjs-launcher":"^1.0.4","@metahub/karma-jasmine-jquery":"^4.0.1","karma-ng-html2js-preprocessor":"1.0.0"},"_npmOperationalInternal":{"tmp":"tmp/telemetry-sdk_1.3.0_1722419685513_0.8497886024313688","host":"s3://npm-registry-packages"}}},"time":{"created":"2024-07-31T09:54:45.398Z","modified":"2025-04-04T05:06:57.746Z","1.3.0":"2024-07-31T09:54:45.707Z"},"bugs":{"url":"https://github.com/dicdiksha/sunbird-telemetry-sdk/issues"},"author":{"name":"Manjunath Davanam","email":"manjunathd@ilimi.in"},"license":"MIT","homepage":"https://github.com/dicdiksha/sunbird-telemetry-sdk/tree/master/js#readme","keywords":["telemetry","telemetry library","telemetry-lib","telemetry-library","project-sunbird","sunbird telemetry","telemetry-sdk","telemetry sdk","sunbird telemetry","sunbird-telemetry","sunbird"],"repository":{"url":"git+https://github.com/dicdiksha/sunbird-telemetry-sdk.git","type":"git"},"description":"Telemetry Service javascript library helps to generate the telemetry events.","maintainers":[{"email":"satyanarayana.khaja@trigyn.com","name":"satyadiksha"},{"email":"bharath.raj@trigyn.com","name":"bharathrajjv"},{"email":"Diksha.Leads@trigyn.com","name":"dictrigyngroup"},{"email":"yashveer.negi@trigyn.com","name":"yashveer"},{"email":"tejaswini.giram@trigyn.com","name":"tejaswini19"},{"email":"purushotam.kumar@trigyn.com","name":"purushottam_trigyn"},{"email":"Shailendra.Pratap@trigyn.com","name":"shailendra123"},{"email":"sayali.more@trigyn.com","name":"sayalimore1610"},{"email":"baijanti.yadav@trigyn.com","name":"trigynby"},{"email":"bhoopendra.modanwal@trigyn.com","name":"bmodanwal"}],"readme":"\n ![](https://travis-ci.org/manjudr/telemetry-lib.svg?branch=master)\n [![codecov](https://codecov.io/gh/manjudr/telemetry-lib/branch/master/graph/badge.svg)](https://codecov.io/gh/manjudr/telemetry-lib)\n\n\n\n## Need \n\nThe purpose of a standalone JS library for telemetry is to facilitate capture and distribution of telemetry data by users who would like to use their own apps, content players or portals.  \n\nWe chose to use a JS library for the following reasons:\n\n* All the telemetry events that are generated and synced to the server have the same format (field data types and time zone value)\n\n* It is easy to upgrade to new versions, in case of major changes in telemetry\n\n* There is effortless backward compatibility, as changes are handled within the telemetry library. Any upgrade of the telemetry library does not require code changes in the content\n\n* There are reduced number of API calls\n\n* There are simple API methods to generate the complete telemetry event as only the required fields are passed\n\n## Prerequisites \n\nThe following are prerequisites to use or integrate the JS library:\n\n* JQuery library should be available \n\n* Valid Authtoken and Key to make API calls\n\n* The [telemetry.min.js](https://github.com/project-sunbird/project-sunbird.github.io/blob/dev/pages/developer-docs/telemetry/other_files/telemetry.min.js){:target=\"_blank\"} file\n\n**Note:** For details on generating and using the Authtoken and Key, refer to the section \n\n* Device ID value\n\n**Note:** For details on how to get the device ID value, refer to [website](https://android-developers.googleblog.com/2011/03/identifying-app-installations.html){:target=\"_blank\"}\n\n## Configure\n\nThis JS library helps to generate telemetry events. These events sync to the server or data-pipeline in a batch as defined in the configuration. To log telemetry events, the user has to call the start method by passing the configuration along with other parameters.\n\n**Note:** All telemetry events sync only to the server or data-pipeline, when connected to the Internet.  \n\nTelemetry events are generated based on the configuration of the telemetry library.\n\n**Required Configuration (Context)**\n\n<table>\n  \n  <thead>\n  <tr>\n    <th>Property</th>\n    <th>Description</th>\n    <th>Required</th>\n    <th>Default Value</th>\n  </tr>\n  </thead>\n  <tbody>\n  <tr>\n    <td>pdata</td>\n    <td>Producer data. It is an object containing id, version and pid.</td>\n    <td>true</td>\n    <td>Defaults to genie ex : {\"id\": \"genie\", \"ver\": \"6.5.2567\" pid:\"\"}</td>\n  </tr>\n  <tr>\n    <td>channel</td>\n    <td>It is an string containing unique channel name.</td>\n    <td>true</td>\n    <td>Defaults to in.ekstep</td>\n  </tr>\n  <tr>\n    <td>uid</td>\n    <td>It is an string containing user id.</td>\n    <td>true</td>\n    <td>defaults to \"anonymous\"</td>\n  </tr>\n  <tr>\n    <td>did</td>\n    <td>It is an string containing unique device id. \n      <ul><li>To generate did value for android refer to <a href ='https://android-developers.googleblog.com/2011/03/identifying-app-installations.html'>here</a> ANDROID_ID is generally used for mobiles</li>\n        <li>To generate did value for web client refer <a href = 'https://github.com/Valve/fingerprintjs2'>here</a>. If consumer is not sending any did value then by default library will generate did using <a href ='https://github.com/Valve/fingerprintjs2'>fingerPrintJs2</a>.</li><li>For server side it's mandtory to pass did value</li></ul>\n   </td>\n    <td>true</td>\n    <td>Default to <a href=\"https://github.com/Valve/fingerprintjs2\">fingerPrintjs2</a>(Note: Only for web client)</td>\n  </tr>\n  <tr>\n    <td>authtoken</td>\n    <td>It is an string containing consumer token to access the API</td>\n    <td>true</td>\n    <td></td>\n  </tr>\n  <tr>\n    <td>Property</td>\n    <td>Description</td>\n    <td>Required</td>\n    <td>Default Value</td>\n  </tr>\n  <tr>\n    <td>env</td>\n    <td>It is an string containing Unique environment where the event has occurred</td>\n    <td>true</td>\n    <td>defaults to \"ContentPlayer\"</td>\n  </tr>\n  </tbody>\n</table>\n\n**Additional Configuration**\n\n<table>\n  <tr>\n    <td>Property</td>\n    <td>Description</td>\n    <td>Required</td>\n    <td>Default Value</td>\n  </tr>\n  <tr>\n    <td>sid</td>\n    <td>It is an string containing user session id.</td>\n    <td>optional</td>\n    <td> </td>\n  </tr>\n  <tr>\n    <td>batchsize</td>\n    <td>It is an int containing number of events count to sync at a time. Can be configured from min value 10 to max value 1000.</td>\n    <td>optional</td>\n    <td>defaults to 20</td>\n  </tr>\n  <tr>\n    <td>mode</td>\n    <td>It is an string which defines to identify preview used by the user to play/edit/preview.</td>\n    <td>optional</td>\n    <td>defaults to \"play\"</td>\n  </tr>\n  <tr>\n    <td>host</td>\n    <td>It is an string containing API endpoint host.</td>\n    <td>optional</td>\n    <td>defaults to \"https://api.ekstep.in\"</td>\n  </tr>\n  <tr>\n    <td>endpoint</td>\n    <td>It is an string containing API endpoint. Please don't change default value. Update this only when the data is proxied</td>\n    <td>optional</td>\n    <td>Defaults to \"/v3/telemetry\"</td>\n  </tr>\n  <tr>\n    <td>tags</td>\n    <td>It is an array. It can be used to tag devices so that summaries/metrics can be derived via specific tags. Helpful during analysis</td>\n    <td>optional</td>\n    <td>Defaults to []</td>\n  </tr>\n  <tr>\n    <td>cdata</td>\n    <td>It is an array. Correlation data. Can be used to correlate multiple events. Generally used to track user flow</td>\n    <td>optional</td>\n    <td>Defaults to []</td>\n  </tr>\n  <tr>\n    <td>dispatcher</td>\n    <td></td>\n    <td></td>\n    <td></td>\n  </tr>\n</table>\n\n**Sample:**\n\n<pre>\n{\n  \"pdata\": {\n    \"id\": \"genie\",\n    \"ver\": \"6.5.2567\",\n    \"pid\": \"\"\n  },\n\n  \"env\": \"ContentPlayer\",\n  \"channel\": \"XXXX\",\n  \"did\": \"20d63257084c2dca33f31a8f14d8e94c0d939de4\",\n  \"authtoken\": \"XXXX\",\n  \"uid\": \"anonymous\",\n  \"sid\": \"85e8a2c8-bb8e-4666-a21b-c29ec590d740\",\n  \"batchsize\": 20,\n  \"mode\": \"play\",\n  \"host\": \"XXXX\",\n  \"endpoint\": \"/v3/telemetry\",  \n  \"tags\": [],\n  \"cdata\": []\n}\n</pre>\n\n**Dispatcher:**\n\nUser can define custom dispatcher to override the default functionality of telemetry sync. By default telemetry events will send to default server/host. User can override this default functionality by defining his own \"dispatcher\" object to handle telemetry events.\n\n<pre>\nvar customDispatcher = {\n    dispatch: function(event){\n        // User defined logic to send telemetry to server or store locally etc..\n    }\n};\n</pre>\n\nSend this object as dispatcher in the above sample configuration (\"dispatcher\":customDispatcher).\n\n## How to use telemetry JS library\n\nDownload the telemetry-sdk npm module from [here](https://www.npmjs.com/package/@dicdikshaorg/telemetry-sdk) \n\n<pre>\nnpm i @dicdikshaorg/telemetry-sdk\n</pre>\n\n**Example:**\n\n<pre>\n$t = require('@dicdikshaorg/telemetry-sdk');   \n$t.start(config, contentId, contentVer,data, options);\n</pre>\n   \n\nTo use the telemetry JS libraries, add the following to your HTML/application. The file path is a relative path, for example; assets/js to the associated files within the html content.\n\n<pre>\n&#x3C;!-- External Libraries --&#x3E;\n  &#x3C;script src=&#x22;[relative_path]/jquery.min.js&#x22;&#x3E;&#x3C;/script&#x3E;\n  \n  &#x3C;!-- Telemetry JS library --&#x3E;\n  &#x3C;script src=&#x22;[relative_path]/telemetry.min.js&#x22;&#x3E;&#x3C;/script&#x3E;\n  &#x3C;script src=&#x22;[relative_path]/auth-token-generator.min.js&#x22;&#x3E;&#x3C;/script&#x3E;\n  &#x3C;script&#x3E;\n    function init() {\n          // Generate auth token\n          // Key: Partner generated key\n          // secret: partner secret value \n          let token = AuthTokenGenerate.generate(key, secret);\n          config.authToken = token;\n          let startEdata = {};\n          let options = {};\n          $t.start(config, &#x22;content_id, &#x22;contetn_ver&#x22;, startEdata, options );\n      }\n  init()\n  &#x3C;/script&#x3E;\n</pre>\n\n\n\n\n## Telemetry API methods\n\nEvery API method has an associated event. The following API methods log details of the associated telemetry event. \n\n* [Start](developer-docs/telemetry/jslibrary/#start) - This method initializes capture of telemetric data associated to the start of user action \n\n* [Impression](developer-docs/telemetry/jslibrary/#impression) - This method is used to capture telemetry for user visits to  a specific page. \n\n* [Interact](developer-docs/telemetry/jslibrary/#interact) - This method is used to capture user interactions on a page. For example, search, click, preview, move, resize, configure\n\n* [Assess ](developer-docs/telemetry/jslibrary/#access)- This method is used to capture user assessments that happen while playing content.\n\n* [Response](developer-docs/telemetry/jslibrary/#response) - This method is used to capture user responses. For example; response to a poll, calendar event or a question.\n\n* [Interrupt](developer-docs/telemetry/jslibrary/#interrupt) - This method is used to capture  interrupts triggered during user activity. For example;  mobile app sent to background, call on the mobile, etc.\n\n* [End](developer-docs/telemetry/jslibrary/#end) - This method is used to capture closure after all the activities are completed\n\n* [Feedback](developer-docs/telemetry/jslibrary/#feedback) - This method is used to capture user feedback\n\n* [Share](developer-docs/telemetry/jslibrary/#share) - This method is used to capture everything associated with sharing. For example; Share content, telemetry data, link, file etc.\n\n* [Audit](developer-docs/telemetry//jslibrary/#audit) - This method is used when an object is changed to know previous and current state. This includes lifecycle changes as well.\n\n* [Error](developer-docs/telemetry/jslibrary/#error) - This method is used to capture when users face an error\n\n* [Heartbeat](developer-docs/telemetry/jslibrary/#heartbeat) - This method is used to know is process is running or not.\n\n* [Log](developer-docs/telemetry/jslibrary/#log) - This method is used to capture generic logging of events.  For example; capturing logs for API calls, service calls, app updates etc.\n\n* [Search](developer-docs/telemetry/jslibrary/#search) - This method is used to capture the search state i.e. when search is triggered for content, item, assets etc.\n\n* [Metrics](developer-docs/telemetry/jslibrary/#metrics) - Service business metrics (also accessible via health API)\n\n* [Summary](developer-docs/telemetry/jslibrary/#summary) - Summary event\n\n* [Exdata](developer-docs/telemetry/jslibrary/#exdata) - This method is used as a generic wrapper event to capture encrypted or serialized data\n\n \n \n\n### Start\n\nThis API is used to log telemetry when users view content or initiate game play \n\n<pre>\nstart: function(config, contentId, contentVer, data, options) { }\n</pre>\n\nRequest Arguments:\n\n<pre>\nlet config = Object; // Telemetry Configurations\nlet contentId = String; //Required. Id of the content\nlet contentVer = String; //Required. Version of the content. Defaults to \"1.0\"\nlet data = { // Required. event data\n    \"type\": String, //Required.  app, session, editor, player, workflow, assessment\n    \"mode\": \"\", //Required. mode of preview: preview, edit or play \n    \"stageid\": \"\" //Required. stage id where the play has been initiated\n};\nlet options = { // Optional\n    context: {}, // To override the existing context\n    object: {}, // To override the existing object\n    actor: {}, // To override the existing actor\n    tags: {}, // To override the existing tags\n    runningEnv: \"server\" // It can be either client or server\n};\n\n</pre>\n\n### Impression\n\nThis API is used to log telemetry when users visit a specific page.\n\n<pre>\nimpression: function(data, options) { }\n</pre>\n\nRequest Arguments:\n\n<pre>\n\nlet data = { // Required\n    \"type\": String, //Required. Impression type (list, detail, view, edit, workflow, search)\n    \"subtype\": String, //Optional. Additional subtype. \"Paginate\", \"Scroll\"\n    \"pageid\": String, //Required.  Unique page id\n    \"itype\": \"\", // type of interaction - SWIPE, SCRUB (fast forward using page thumbnails) or AUTO\n    \"stageto\": \"\" // game level, stage of page id to which the navigation was done\n};\n</pre>\n\n<pre>\nlet options = { // Optional\n    context: {}, // To override the existing context\n    object: {}, // To override the existing object\n    actor: {}, // To override the existing actor\n    tags: {}, // To override the existing tags\n    runningEnv: \"server\" // It can be either client or server\n};\n</pre>  \n\n\n### Interact\n\nThis API is used to log telemetry of user interactions on the page. For example, search, click, preview, move, resize, configure\n\n<pre>\ninteract: function(data, options) { }\n</pre>\n\nRequest Arguments:\n\n<pre>\n\nlet data = { // Required\n    \"type\": \"\", // Required. Type of interaction TOUCH,DRAG,DROP,PINCH,ZOOM,SHAKE,ROTATE,SPEAK,LISTEN,WRITE,DRAW,START,ENDCHOOSE,ACTIVATE,SHOW,HIDE,SCROLL,HEARTBEAT,OTHER\n    \"subtype\": \"\", // Optional. Additional types for a global type. For ex: for an audio the type is LISTEN and thesubtype can be one of PLAY,PAUSE,STOP,RESUME,END\n    \"id\": \"\", // Required. Resource (button, screen, page, etc) id on which the interaction happened - use systemidentifiers when reporting device events\n    \"pageid\": \"\", // Optional. Stage or page id on which the event happened\n    \"extra\": { // Optional. Extra attributes for an interaction\n        \"pos\": [{ \"x\": , \"y\": , \"z\": }], // Array of positional attributes. For ex: Drag and Drop has two positional attributes. One where the drag has started and the drop point\n        \"values\": [], // Array of values, e.g. for timestamp of audio interactions\n        \"tid\": \"\", // When interaction is between multiple resources, (e.g. drag and drop) - target resource id\n        \"uri\": \"\" // Unique external resource identifier if any (for recorded voice, image, etc.)\n    }\n};\n</pre>\n<pre>\nlet options = { // Optional\n    context: {}, // To override the existing context\n    object: {}, // To override the existing object\n    actor: {}, // To override the existing actor\n    tags: {}, // To override the existing tags\n    runningEnv: \"server\" // It can be either client or server\n}; \n</pre>  \n\n### Assess\n\nThis API is used to log telemetry of assessments that have occured when the user is viewing content\n\n<pre>\nassess: function(data, options) { }\n</pre>\n\nRequest Arguments:\n\n<pre>\nlet QUESTION = {\n    \"id\": \"\", // unique assessment question id. its an required property.\n    \"maxscore\", // user defined score to this assessment/question.\n    \"exlength\": , // expected time (decimal number) in seconds that ideally child should take\n    \"params\": [ // Array of parameter tuples\n        { \"id\": \"value\" } // for ex: if var1 is substituted with 5 apples the parameter is {\"var1\":\"5\"}\n    ],\n    \"uri\": \"\", // Unique external resource identifier if any (for recorded voice, image, etc.)\n    \"desc\": \"short description\",\n    \"title\": \"title\",\n    \"mmc\": [], // User defined missing micros concepts\n    \"mc\": [] // micro concepts list\n}\n\nlet data = { //Required\n    \"item\": QUESTION, // Required. Question Data\n    \"pass\": \"\", // Required. Yes, No. This is case-sensitive. default value: No.\n    \"score\": \"\", // Required. Evaluated score (Integer or decimal) on answer(between 0 to 1), default is 1 if pass=YES or 0 if pass=NO. \n    \"resvalues\": [{ \"id\": \"value\" }], // Required. Array of key-value pairs that represent child answer (result of this assessment)\n    \"duration\": \"\" // Required. time taken (decimal number) for this assessment in seconds\n};\n</pre>\n<pre>\n let options = { //Optional\n    context: {}, // To override the existing context\n    object: {}, // To override the existing object\n    actor: {}, // To override the existing actor\n    tags: {}, // To override the existing tags\n    runningEnv: \"server\" // It can be either client or server\n};\n</pre>\n\n### Response\n\nThis API is used to log telemetry of user response. For example; Responded to assessments.\n\n<pre>\nresponse: function(data, options) { }\n</pre>\n\nRequest Arguments:\n\n<pre>\nlet TARGET = {\n    \"id\": \"\", // Required. unique id for the target\n    \"ver\": \"\", // Required. version of the target\n    \"type\": \"\", // Required. Type of the target\n    \"parent\": {\n        \"id\": \"\", // Optional. parent id of the object\n        \"type\": \"\" // Optional. parent type of the object. Required if parentid is present.\n    }\n};\n\nlet data = { // Required\n    \"target\": TARGET, // Required. Target of the response\n    \"qid\": \"\", // Required. Unique assessment/question id\n    \"type\": \"\", // Required. Type of response. CHOOSE, DRAG, SELECT, MATCH, INPUT, SPEAK, WRITE\n    \"values\": [{ \"key\": \"value\" }] // Required. Array of response tuples. For ex: if lhs option1 is matched with rhs optionN - [{\"lhs\":\"option1\"}, {\"rhs\":\"optionN\"}]\n};\n</pre>\n<pre>\nlet options = { // Optional\n    context: {}, // To override the existing context\n    object: {}, // To override the existing object\n    actor: {}, // To override the existing actor\n    tags: {}, // To override the existing tags\n    runningEnv: \"server\" // It can be either client or server\n};\n</pre>\n\n### Interrupt\n\nThis API is used to log telemetry for any interruptions that have occurred when a user is viewing content or playing games. For example; screen lock, incoming call, etc.\n\n<pre>\ninterrupt: function(data, options) { }\n</pre>\n\nRequest Arguments:\n\n<pre>\nlet data = { //Required\n    \"type\": \"\", // Required. Type of interuption\n    \"pageid\": \"\", // Optional. Current Stage/Page unique id on which interuption occured\n    \"eventid\": \"\" // Optional. unique event ID\n};\n</pre>\n  \n<pre>\n let options = { // Optional\n    context: {}, // To override the existing context\n    object: {}, // To override the existing object\n    actor: {}, // To override the existing actor\n    tags: {}, // To override the existing tags\n    runningEnv: \"server\" // It can be either client or server\n};\n</pre>\n\n\n\n### Feedback\n\nThis API is used to log telemetry of feedback provided by the user.\n\n<pre>\n// To log content start/play event\nfeedback: function(data, options) { }\n</pre>\n\nRequest Arguments:\n\n<pre>\nlet data = { // Required\n    \"contentId\": \"\", // Required. Id of the content\n    \"rating\": 3, // Optional. Numeric score (+1 for like, -1 for dislike, or 4.5 stars given in a rating)\n    \"comments\": \"User entered feedback\" // Optional. Text feedback (if any)\n};\n</pre>\n\n<pre>\nlet options = { // Optional\n    context: {}, // To override the existing context\n    object: {}, // To override the existing object\n    actor: {}, // To override the existing actor\n    tags: {}, // To override the existing tags\n    runningEnv: \"server\" // It can be either client or server\n};\n</pre>\n\n### Share\n\nThis API is used to log telemetry when a user shares any content with other users.\n\n<pre>\n// To log content start/play event\nshare: function(data, options) { }\n</pre>\n\nRequest Arguments:\n\n<pre>\nlet data = { // Required\n    \"dir\": \"\", // In/Out\n    \"type\": \"\", // File/Link/Message\n    \"items\": [{ // Required. array of items shared\n        \"obj\": {\n            \"id\": \"\",\n            \"type\": \"\",\n            \"ver\": \"\"\n        },\n        \"params\": [\n            { \"key\": \"value\" }\n        ],\n        \"origin\": { // Origin of the share file/link/content\n            \"id\": \"\", // Origin id\n            \"type\": \"\" // Origin type\n        },\n        \"to\": {\n            \"id\": \"\",\n            \"type\": \"\"\n        }\n    }]\n};\n</pre>\n<pre>\n let options = { // Optional\n    context: {}, // To override the existing context\n    object: {}, // To override the existing object\n    actor: {}, // To override the existing actor\n    tags: {}, // To override the existing tags\n    runningEnv: \"server\" // It can be either client or server\n};\n\n</pre>\n\n### Audit\n\nThis API is used to log telemetry when an object is changed. This includes life-cycle changes as well.\n\n<pre>\naudit: function(data, options) { }\n</pre>\n\nRequest Arguments:\n\n<pre>\nlet data = { // Required\n    \"edata\": {\n        \"props\": [\"\"], // Updated properties\n        \"state\": \"\", // Optional. Current state\n        \"prevstate\": \"\" // Optional. Previous state\n    }\n};\n</pre>\n<pre>\n  let options = { // Optional\n    context: {}, // To override the existing context\n    object: {}, // To override the existing object\n    actor: {}, // To override the existing actor\n    tags: {}, // To override the existing tags\n    runningEnv: \"server\" // It can be either client or server\n};\n</pre>\n\n### Error\n\nThis API is used to log telemetry of any error that has occurred when a user is viewing content or playing games. \n\n<pre>\nerror: function(error, options) { }\n</pre>\n\nRequest Arguments:\n\n<pre>\nlet error = { // Required\n    \"err\": \"\", // Required. Error code\n    \"errtype\": \"\", // Required. Error type classification - \"SYSTEM\", \"MOBILEAPP\", \"CONTENT\"\n    \"stacktrace\": \"\", // Required. Detailed error data/stack trace\n};\n</pre>\n\n<pre>\n let options = { // Optional\n    context: {}, // To override the existing context\n    object: {}, // To override the existing object\n    actor: {}, // To override the existing actor\n    tags: {}, // To override the existing tags\n    runningEnv: \"server\" // It can be either client or server\n};\n</pre>\n\n### Heartbeat\n\nThis API is used to log telemetry for heartbeat event to denote that the process is running.\n\n<pre>\nheartbeat: function(data, options) { }\n</pre>\n\nRequest Arguments:\n\n<pre>\nlet data = { // Required\n    \"edata\": {}\n}\n</pre>\n\n<pre>\n let options = { // Optional\n    context: {}, // To override the existing context\n    object: {}, // To override the existing object\n    actor: {}, // To override the existing actor\n    tags: {}, // To override the existing tags\n    runningEnv: \"server\" // It can be either client or server\n};\n\n</pre>\n\n### Log\n\nThis API is used to log telemetry of generic log events. For example; API calls, service calls, app updates, etc.\n\n<pre>\nlog: function(data, options) { }\n</pre>\n\nRequest Arguments:\n\n<pre>\nlet data = { // Required\n    \"type\": \"\", // Required. Type of log (system, process, api_access, api_call, job, app_update etc)\n    \"level\": \"\", // Required. Level of the log. TRACE, DEBUG, INFO, WARN, ERROR, FATAL\n    \"message\": \"\", // Required. Log message\n    \"params\": [{ \"key\": \"value\" }] // Optional. Additional params in the log message\n};\n</pre>\n\n<pre>\nlet options = { // Optional\n    context: {}, // To override the existing context\n    object: {}, // To override the existing object\n    actor: {}, // To override the existing actor\n    tags: {}, // To override the existing tags\n    runningEnv: \"server\" // It can be either client or server\n};\n</pre>\n\n### Search\n\nThis API is used to log telemetry when a user triggers a search for any content, item or asset \n\n<pre>\nsearch: function(data, options) { }\n</pre>\n\nRequest Arguments:\n\n<pre>\nlet data = { // Required\n    \"type\": \"\", // Required. content, assessment, asset \n    \"query\": \"\", // Required. Search query string \n    \"filters\": {}, // Optional. Additional filters\n    \"sort\": {}, // Optional. Additional sort parameters\n    \"correlationid\": \"\", // Optional. Server generated correlation id (for mobile app's telemetry)\n    \"size\": 333, // Required. Number of search results\n    \"topn\": [{}] // Required. top N (configurable) results with their score\n};\n</pre>\n<pre>\nlet options = { // Optional\n    context: {}, // To override the existing context\n    object: {}, // To override the existing object\n    actor: {}, // To override the existing actor\n    tags: {}, // To override the existing tags\n    runningEnv: \"server\" // It can be either client or server\n}; \n</pre>\n\n### Metrics\n\nThis API is used to log telemetry for service business metrics (also accessible via health API).\n\n<pre>\nmetrics: function(data, options) { }\n</pre>\n\nRequest Arguments:\n\n<pre>\nlet data = { // Required\n    \"edata\": {\n        \"metric1\": Int,\n        \"metric2\": Int\n            /// more metrics, each is a key value\n    }\n};\n</pre>\n\n<pre>\n let options = { // Optional\n    context: {}, // To override the existing context\n    object: {}, // To override the existing object\n    actor: {}, // To override the existing actor\n    tags: {}, // To override the existing tags\n    runningEnv: \"server\" // It can be either client or server\n};\n</pre>\n\n### Summary\n\nThis API is used to log telemetry summary event\n\n<pre>\nsummary: function(data, options) { }\n</pre>\n\nRequest Arguments:\n\n<pre>\nlet data = { // Required\n    \"edata\": {\n        \"type\": \"\", // Required. Type of summary. Free text. \"session\", \"app\", \"tool\" etc\n        \"mode\": \"\", // Optional.\n        \"starttime\": Long, // Required. Epoch Timestamp of app start. Retrieved from first event.\n        \"endtime\": Long, // Required. Epoch Timestamp of app end. Retrieved from last event.\n        \"timespent\": Double, // Required. Total time spent by visitor on app in seconds excluding idle time.\n        \"pageviews\": Long, // Required. Total page views per session(count of CP_IMPRESSION)\n        \"interactions\": Long, // Required. Count of interact events\n        \"envsummary\": [{ // Optional\n            \"env\": String, // High level env within the app (content, domain, resources, community)\n            \"timespent\": Double, // Time spent per env\n            \"visits\": Long // count of times the environment has been visited\n        }],\n        \"eventssummary\": [{ // Optional\n            \"id\": String, // event id such as CE_START, CE_END, CP_INTERACT etc.\n            \"count\": Long // Count of events.\n        }],\n        \"pagesummary\": [{ // Optional\n            \"id\": String, // Page id\n            \"type\": String, // type of page - view/edit\n            \"env\": String, // env of page\n            \"timespent\": Double, // Time taken per page\n            \"visits\": Long // Number of times each page was visited\n        }]\n    }\n};\n</pre>\n\n<pre>\n  let options = { // Optional\n    context: {}, // To override the existing context\n    object: {}, // To override the existing object\n    actor: {}, // To override the existing actor\n    tags: {}, // To override the existing tags\n    runningEnv: \"server\" // It can be either client or server\n};\n</pre>\n\n### Exdata\n\nThis API is used to log telemetry for external data, while playing content\n\n<pre>\nexdata: function(data, options) { }\n</pre>\n\nRequest Arguments:\n\n<pre>\nlet data = {\n    \"type\":\"\" - Free flowing text.For ex: partnerdata,xapi etc\n   ....Serialized data(can be either encrypted / encoded / stringified)\n\n};\n</pre>\n\n<pre>\n  let options = { // Optional\n    context: {}, // To override the existing context\n    object: {}, // To override the existing object\n    actor: {}, // To override the existing actor\n    tags: {}, // To override the existing tags\n    runningEnv: \"server\" // It can be either client or server\n};\n</pre>\n\n### End\n\nThis API is used to log telemetry while the user is closing or exiting the content or game\n\n<pre>\nend: function(data, options) { }\n</pre>\n\nRequest Arguments:\n\n<pre>\nlet data = { // Required\n    \"contentId\": \"\", // Required. Id of the content\n    \"type\": \"\", // Required. app, session, editor, player, workflow, assessment\n    \"duration\": \"\", // Required. Total duration from start to end in seconds\n    \"pageid\": \"\", // Optional. Page/Stage id where the end has happened.\n    \"summary\": [{ \"key\": \"value\" }] // Optional. Summary of actions done between start and end. For ex: \"progress\" for player session, \"nodesModified\" for collection editor\n};\n</pre>\n\n<pre>\n  let options = { // Optional\n    context: {}, // To override the existing context\n    object: {}, // To override the existing object\n    actor: {}, // To override the existing actor\n    tags: {}, // To override the existing tags\n    runningEnv: \"server\" // It can be either client or server\n};\n</pre>\n\n\n### ResetContext\n  This is used to reset the current context value with new context object.\n\n<pre>\n @param {context} Object    - If context is undefined then library is reset to previous event context value.\n $t.resetContext(context) \n</pre>\n\n### ResetObject\n Which is used reset the current object value with new obj\n\n<pre>\n @param {obj} Object      - If the Object is undefined then library is reset to previous event object value.\n $t.resetObject(obj) \n</pre>\n\n### ResetActor\n  Which is used reset the current actor value with new actor   \n\n<pre>\n @param {actor} Object    - If the actor is undefined then library is reset to previous event actor value.\n $t.resetActor(actor) \n</pre>\n\n### ResetTags\n  Which is used to reset the current tag's value with new tag's\n\n<pre>\n @param {tags} Array      - If tags are undefined then library is reset to previous event tags value.\n $t.resetTags(tags) \n</pre>\n\n\n\n\n## ChangeLogs\n\n  ******  ******\n**[0.0.1](https://github.com/manjudr/telemetry-lib/releases/tag/v1.0.0)**\n \n  * Initial version of the telemetry-sdk [npm](https://www.npmjs.com/package/@dicdikshaorg/telemetry-sdk)\n\n**[0.0.2](https://github.com/manjudr/telemetry-lib/releases/tag/v1.0.0)**\n \n  * Bug fixes\n\n**[0.0.3](https://github.com/manjudr/telemetry-lib/releases/tag/v1.0.1)**\n\n  * Name space changes in the code \n  * Removed `EkTelemetry` keyword in the code and provided a backward compatibility\n\n**[0.0.4](https://github.com/manjudr/telemetry-lib/releases/tag/v1.0.2)**\n\n  * Bug fixes - Duration issue fix in both START and END Event (Converting millisecond to seconds)\n  * Test case setup and improved code coverage\n  * Travis integration     \n\n\n  \n\n    \n","readmeFilename":"README.md"}