Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

insights-js

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

insights-js - npm Package Compare versions

Comparing version 1.2.7 to 1.2.8

2

dist/insights-js.cjs.js

@@ -208,4 +208,4 @@ 'use strict';

var request = new XMLHttpRequest();
request.open("post", "https://getinsights.io/app/tics", true);
request.setRequestHeader("Content-Type", "application/json");
request.open("post", "https://getinsights.io/app/tics", true);
request.send(JSON.stringify(body));

@@ -212,0 +212,0 @@ };

@@ -204,4 +204,4 @@ function isInBrowser() {

var request = new XMLHttpRequest();
request.open("post", "https://getinsights.io/app/tics", true);
request.setRequestHeader("Content-Type", "application/json");
request.open("post", "https://getinsights.io/app/tics", true);
request.send(JSON.stringify(body));

@@ -208,0 +208,0 @@ };

@@ -210,4 +210,4 @@ (function (global, factory) {

var request = new XMLHttpRequest();
request.open("post", "https://getinsights.io/app/tics", true);
request.setRequestHeader("Content-Type", "application/json");
request.open("post", "https://getinsights.io/app/tics", true);
request.send(JSON.stringify(body));

@@ -214,0 +214,0 @@ };

@@ -1,1 +0,1 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self).insights={})}(this,function(a){"use strict";function s(){return"undefined"!=typeof window}function u(){return location.protocol+"//"+location.host}function c(){if(!s())return!1;var t=document.referrer||"",e=u();return t.substr(0,e.length)===e}function p(){return s()?{type:"locale",value:function(){var t=void 0!==navigator.languages?navigator.languages[0]:navigator.language;return t&&5===t.length&&"-"===t[2]?t.substr(0,3)+t.substr(3).toLocaleUpperCase():t}()||"<none>"}:{type:"locale",value:"<not-in-browser>"}}function h(){return s()?{type:"screen-type",value:function(){var t=window.innerWidth;return t<=414?"XS":t<=800?"S":t<=1200?"M":t<=1600?"L":"XL"}()}:{type:"screen-type",value:"<not-in-browser>"}}function g(){return s()?c()?{type:"referrer",value:"<none>"}:{type:"referrer",value:document.referrer||"<none>"}:{type:"referrer",value:"<not-in-browser>"}}function l(t,e){if(void 0===t&&(t=!1),void 0===e&&(e=!1),!s())return{type:"path",value:"<not-in-browser>"};var a=window.location.pathname,r=window.location.hash,n=window.location.search;return t&&e?a+=r:t?a+=r.substr(0,r.length-n.length):e&&(a+=n),{type:"path",value:a}}function v(t,e){return{type:"transition",value:t+" -> "+e}}function d(t,e){return void 0===e&&(e=""),t<5e3?{type:"duration-interval",value:e+"< 5s"}:t<15e3?{type:"duration-interval",value:e+"< 15s"}:t<3e4?{type:"duration-interval",value:e+"< 30s"}:t<6e4?{type:"duration-interval",value:e+"< 1m"}:t<3e5?{type:"duration-interval",value:e+"< 5m"}:{type:"duration-interval",value:e+"> 5m"}}var t=Object.freeze({locale:p,screenType:h,referrer:g,path:l,transition:v,durationInterval:d}),r={},n=(e.prototype.track=function(t){if(this.options.disabled||!s())return Promise.resolve();if(t.unique){var e=JSON.stringify(t);if(this.uniques[e])return Promise.resolve();this.uniques[e]=!0}var a={id:t.id,projectId:this.projectId,ignoreErrors:this.options.ignoreErrors||!1};t.remove&&(a.remove=!0),t.parameters&&(a.parameters=t.parameters),t.update&&(a.update=!0);var r=new XMLHttpRequest;r.setRequestHeader("Content-Type","application/json"),r.open("post","https://getinsights.io/app/tics",!0),r.send(JSON.stringify(a))},e.prototype.trackPages=function(t){if(!s())return{stop:function(){}};if(this.trackPageData)return this.trackPageData.result;var e=setInterval(this.trackPageChange,2e3),a=t||{},r=a.hash,n=void 0!==r&&r,i=a.search,o=void 0!==i&&i;return this.trackPageData={hash:n,search:o,path:l(n,o).value,isOnFirstPage:!0,time:Date.now(),result:{stop:function(){clearInterval(e)}}},this.trackSinglePage(!0,this.trackPageData.path),window.addEventListener("unload",this.trackLastPageTimeSpent),this.trackPageData.result},e.prototype.getPreviousPage=function(t){var e=this.trackPageData&&this.trackPageData.path;return!t&&e?e:c()?document.referrer.replace(u(),""):document.referrer},e.prototype.trackPageChange=function(){if(this.trackPageData){var t=this.trackPageData,e=l(t.hash,t.search).value;e!==this.trackPageData.path&&this.trackSinglePage(!1,e)}},e.prototype.trackSinglePage=function(t,e){if(this.trackPageData){this.trackPageData.isOnFirstPage=t&&!c();var a=this.trackPageData,r=a.time,n={path:e};a.isOnFirstPage&&(n.uniqueViews=e,n.referrer=g(),n.locale=p(),n.screenType=h());var i=this.getPreviousPage(t);if(i&&i!==e){n.transitions=v(i,e);var o=Date.now();this.trackPageData.time=o,n.duration=d(o-r,i+" - ")}this.trackPageData.path=e,this.track({id:"page-views",parameters:n})}},e.prototype.trackLastPageTimeSpent=function(){var t=this.trackPageData&&this.trackPageData.time;if(t&&"function"==typeof navigator.sendBeacon&&!this.options.disabled&&this.trackPageData){var e=this.trackPageData,a=e.isOnFirstPage,r=e.path,n={};n.duration=d(Date.now()-t,r+" - ");var i=document.activeElement&&document.activeElement.href||"",o=u();i?"/"!==i[0]&&i.substr(0,o.length)!==u()&&(n.transitions=v(r,i)):n.bounces=a?"Yes":"No",navigator.sendBeacon=navigator.sendBeacon||function(t,e){var a=new XMLHttpRequest;a.open("post",t,!1),a.send(e)},navigator.sendBeacon("https://getinsights.io/app/tics",JSON.stringify({id:"page-views",projectId:this.projectId,parameters:n,ignoreErrors:this.options.ignoreErrors||!1,update:!0}))}},e);function e(t,e){void 0===e&&(e=r),this.projectId=t,this.options=e,this.uniques={},this.trackPageData=null,this.trackPageChange=this.trackPageChange.bind(this),this.trackLastPageTimeSpent=this.trackLastPageTimeSpent.bind(this)}a.DEFAULT_APP=null,a.App=n,a.init=function(t,e){if(!s()||a.DEFAULT_APP)throw new Error("Already initialized!");return a.DEFAULT_APP=new n(t,e),a.DEFAULT_APP},a.parameters=t,a.track=function(t){a.DEFAULT_APP&&s()&&a.DEFAULT_APP.track(t)},a.trackPages=function(t){return a.DEFAULT_APP&&s()?a.DEFAULT_APP.trackPages(t):{stop:function(){}}},Object.defineProperty(a,"__esModule",{value:!0})});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self).insights={})}(this,function(a){"use strict";function s(){return"undefined"!=typeof window}function u(){return location.protocol+"//"+location.host}function c(){if(!s())return!1;var t=document.referrer||"",e=u();return t.substr(0,e.length)===e}function p(){return s()?{type:"locale",value:function(){var t=void 0!==navigator.languages?navigator.languages[0]:navigator.language;return t&&5===t.length&&"-"===t[2]?t.substr(0,3)+t.substr(3).toLocaleUpperCase():t}()||"<none>"}:{type:"locale",value:"<not-in-browser>"}}function h(){return s()?{type:"screen-type",value:function(){var t=window.innerWidth;return t<=414?"XS":t<=800?"S":t<=1200?"M":t<=1600?"L":"XL"}()}:{type:"screen-type",value:"<not-in-browser>"}}function g(){return s()?c()?{type:"referrer",value:"<none>"}:{type:"referrer",value:document.referrer||"<none>"}:{type:"referrer",value:"<not-in-browser>"}}function l(t,e){if(void 0===t&&(t=!1),void 0===e&&(e=!1),!s())return{type:"path",value:"<not-in-browser>"};var a=window.location.pathname,r=window.location.hash,n=window.location.search;return t&&e?a+=r:t?a+=r.substr(0,r.length-n.length):e&&(a+=n),{type:"path",value:a}}function v(t,e){return{type:"transition",value:t+" -> "+e}}function d(t,e){return void 0===e&&(e=""),t<5e3?{type:"duration-interval",value:e+"< 5s"}:t<15e3?{type:"duration-interval",value:e+"< 15s"}:t<3e4?{type:"duration-interval",value:e+"< 30s"}:t<6e4?{type:"duration-interval",value:e+"< 1m"}:t<3e5?{type:"duration-interval",value:e+"< 5m"}:{type:"duration-interval",value:e+"> 5m"}}var t=Object.freeze({locale:p,screenType:h,referrer:g,path:l,transition:v,durationInterval:d}),r={},n=(e.prototype.track=function(t){if(this.options.disabled||!s())return Promise.resolve();if(t.unique){var e=JSON.stringify(t);if(this.uniques[e])return Promise.resolve();this.uniques[e]=!0}var a={id:t.id,projectId:this.projectId,ignoreErrors:this.options.ignoreErrors||!1};t.remove&&(a.remove=!0),t.parameters&&(a.parameters=t.parameters),t.update&&(a.update=!0);var r=new XMLHttpRequest;r.open("post","https://getinsights.io/app/tics",!0),r.setRequestHeader("Content-Type","application/json"),r.send(JSON.stringify(a))},e.prototype.trackPages=function(t){if(!s())return{stop:function(){}};if(this.trackPageData)return this.trackPageData.result;var e=setInterval(this.trackPageChange,2e3),a=t||{},r=a.hash,n=void 0!==r&&r,i=a.search,o=void 0!==i&&i;return this.trackPageData={hash:n,search:o,path:l(n,o).value,isOnFirstPage:!0,time:Date.now(),result:{stop:function(){clearInterval(e)}}},this.trackSinglePage(!0,this.trackPageData.path),window.addEventListener("unload",this.trackLastPageTimeSpent),this.trackPageData.result},e.prototype.getPreviousPage=function(t){var e=this.trackPageData&&this.trackPageData.path;return!t&&e?e:c()?document.referrer.replace(u(),""):document.referrer},e.prototype.trackPageChange=function(){if(this.trackPageData){var t=this.trackPageData,e=l(t.hash,t.search).value;e!==this.trackPageData.path&&this.trackSinglePage(!1,e)}},e.prototype.trackSinglePage=function(t,e){if(this.trackPageData){this.trackPageData.isOnFirstPage=t&&!c();var a=this.trackPageData,r=a.time,n={path:e};a.isOnFirstPage&&(n.uniqueViews=e,n.referrer=g(),n.locale=p(),n.screenType=h());var i=this.getPreviousPage(t);if(i&&i!==e){n.transitions=v(i,e);var o=Date.now();this.trackPageData.time=o,n.duration=d(o-r,i+" - ")}this.trackPageData.path=e,this.track({id:"page-views",parameters:n})}},e.prototype.trackLastPageTimeSpent=function(){var t=this.trackPageData&&this.trackPageData.time;if(t&&"function"==typeof navigator.sendBeacon&&!this.options.disabled&&this.trackPageData){var e=this.trackPageData,a=e.isOnFirstPage,r=e.path,n={};n.duration=d(Date.now()-t,r+" - ");var i=document.activeElement&&document.activeElement.href||"",o=u();i?"/"!==i[0]&&i.substr(0,o.length)!==u()&&(n.transitions=v(r,i)):n.bounces=a?"Yes":"No",navigator.sendBeacon=navigator.sendBeacon||function(t,e){var a=new XMLHttpRequest;a.open("post",t,!1),a.send(e)},navigator.sendBeacon("https://getinsights.io/app/tics",JSON.stringify({id:"page-views",projectId:this.projectId,parameters:n,ignoreErrors:this.options.ignoreErrors||!1,update:!0}))}},e);function e(t,e){void 0===e&&(e=r),this.projectId=t,this.options=e,this.uniques={},this.trackPageData=null,this.trackPageChange=this.trackPageChange.bind(this),this.trackLastPageTimeSpent=this.trackLastPageTimeSpent.bind(this)}a.DEFAULT_APP=null,a.App=n,a.init=function(t,e){if(!s()||a.DEFAULT_APP)throw new Error("Already initialized!");return a.DEFAULT_APP=new n(t,e),a.DEFAULT_APP},a.parameters=t,a.track=function(t){a.DEFAULT_APP&&s()&&a.DEFAULT_APP.track(t)},a.trackPages=function(t){return a.DEFAULT_APP&&s()?a.DEFAULT_APP.trackPages(t):{stop:function(){}}},Object.defineProperty(a,"__esModule",{value:!0})});
{
"name": "insights-js",
"version": "1.2.7",
"version": "1.2.8",
"description": "Javascript client for getinsights.io",

@@ -5,0 +5,0 @@ "keywords": [],

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc