Socket
Socket
Sign inDemoInstall

@siteminder/canvas-analytics-js

Package Overview
Dependencies
Maintainers
126
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@siteminder/canvas-analytics-js - npm Package Compare versions

Comparing version 0.3.4 to 0.3.5

13

dist/analytics.cjs.js

@@ -79,2 +79,3 @@ 'use strict';

.join('&');
if(sharedQueryString.length) sharedQueryString += '&';
}

@@ -86,11 +87,9 @@

case 'pageview':
if (sharedQueryString.length > 0) {
sharedQueryString += '&';
}
fullQueryString += `?${sharedQueryString}dp=${encodeURIComponent(window.location.pathname)}&dh=${encodeURIComponent(window.location.host)}&dt=${encodeURIComponent(document.title)}`;
fullQueryString += `?${sharedQueryString}`
+`dp=${encodeURIComponent(window.location.pathname)}`
+`&dh=${encodeURIComponent(window.location.host)}`
+`&dt=${encodeURIComponent(document.title)}`;
break;
case 'event':
if (sharedQueryString.length > 0) {
fullQueryString += `?${sharedQueryString}`;
}
fullQueryString += `?${sharedQueryString}dh=${encodeURIComponent(window.location.host)}`;
break;

@@ -97,0 +96,0 @@ default:

@@ -77,2 +77,3 @@ var request = {

.join('&');
if(sharedQueryString.length) sharedQueryString += '&';
}

@@ -84,11 +85,9 @@

case 'pageview':
if (sharedQueryString.length > 0) {
sharedQueryString += '&';
}
fullQueryString += `?${sharedQueryString}dp=${encodeURIComponent(window.location.pathname)}&dh=${encodeURIComponent(window.location.host)}&dt=${encodeURIComponent(document.title)}`;
fullQueryString += `?${sharedQueryString}`
+`dp=${encodeURIComponent(window.location.pathname)}`
+`&dh=${encodeURIComponent(window.location.host)}`
+`&dt=${encodeURIComponent(document.title)}`;
break;
case 'event':
if (sharedQueryString.length > 0) {
fullQueryString += `?${sharedQueryString}`;
}
fullQueryString += `?${sharedQueryString}dh=${encodeURIComponent(window.location.host)}`;
break;

@@ -95,0 +94,0 @@ default:

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.Analytics=t()}(this,function(){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var a={get:function(e){"jsonp"===e.type?this.jsonp(e):console.log("Unsupported request method!")},jsonp:function(e){var t=e.url,n=document.createElement("script");n.setAttribute("src",t),document.getElementsByTagName("head")[0].appendChild(n),n.parentNode.removeChild(n)}},e=function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e};function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var l=(e(s,[{key:"apply",value:function(){var e=this.buildEventHandler({serverUrl:this.serverUrl,hit:this.hit});this.targetElement.addEventListener?this.targetElement.addEventListener(this.eventType,e):console.log("Failed to subscribe to a '"+this.eventType+"' event on '"+(this.targetElement&&this.targetElement.tagName||this.targetElement)+"' element.")}},{key:"buildEventHandler",value:function(e){var t=e.serverUrl,n=e.hit,r=t+"/"+n.type,o="";n.data&&(o=Object.keys(n.data).map(function(e){return encodeURIComponent(e)+"="+encodeURIComponent(n.data[e])}).join("&"));var i="";switch(n.type){case"pageview":0<o.length&&(o+="&"),i+="?"+o+"dp="+encodeURIComponent(window.location.pathname)+"&dh="+encodeURIComponent(window.location.host)+"&dt="+encodeURIComponent(document.title);break;case"event":0<o.length&&(i+="?"+o);break;default:return void console.log("Unsupported hit type occurred")}return function(){a.get({type:"jsonp",url:r+i})}}}]),s);function s(e){i(this,s);var t=e.targetElement,n=e.eventType,r=e.hit,o=e.serverUrl;this.targetElement=t,this.eventType=n,this.hit=r,this.serverUrl=o}function t(e){i(this,t),this.config=e}return e(t,[{key:"init",value:function(){var i=this,e=this.config,a=e.serverUrl,t=e.trackers,s=e.session;t.forEach(function(e){var t=e.target,n=e.hit;switch(s&&(e.hit.data?e.hit.data[s]=i.session():e.hit.data=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}({},s,i.session())),t.selectorType){case"direct":if(!t.object)break;new l({targetElement:t.object,eventType:t.eventType,hit:n,serverUrl:a}).apply();break;case"querySelector":for(var r=document.querySelectorAll(t.matcher),o=0;o<r.length;o++)new l({targetElement:r[o],eventType:t.eventType,hit:n,serverUrl:a}).apply()}})}},{key:"session",value:function(){var e=localStorage.getItem("session");if(e)return e;var t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)});return localStorage.setItem("session",t),t}}]),t});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.Analytics=t()}(this,function(){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var a={get:function(e){"jsonp"===e.type?this.jsonp(e):console.log("Unsupported request method!")},jsonp:function(e){var t=e.url,n=document.createElement("script");n.setAttribute("src",t),document.getElementsByTagName("head")[0].appendChild(n),n.parentNode.removeChild(n)}},e=function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e};function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var l=(e(s,[{key:"apply",value:function(){var e=this.buildEventHandler({serverUrl:this.serverUrl,hit:this.hit});this.targetElement.addEventListener?this.targetElement.addEventListener(this.eventType,e):console.log("Failed to subscribe to a '"+this.eventType+"' event on '"+(this.targetElement&&this.targetElement.tagName||this.targetElement)+"' element.")}},{key:"buildEventHandler",value:function(e){var t=e.serverUrl,n=e.hit,r=t+"/"+n.type,o="";n.data&&(o=Object.keys(n.data).map(function(e){return encodeURIComponent(e)+"="+encodeURIComponent(n.data[e])}).join("&")).length&&(o+="&");var i="";switch(n.type){case"pageview":i+="?"+o+"dp="+encodeURIComponent(window.location.pathname)+"&dh="+encodeURIComponent(window.location.host)+"&dt="+encodeURIComponent(document.title);break;case"event":i+="?"+o+"dh="+encodeURIComponent(window.location.host);break;default:return void console.log("Unsupported hit type occurred")}return function(){a.get({type:"jsonp",url:r+i})}}}]),s);function s(e){i(this,s);var t=e.targetElement,n=e.eventType,r=e.hit,o=e.serverUrl;this.targetElement=t,this.eventType=n,this.hit=r,this.serverUrl=o}function t(e){i(this,t),this.config=e}return e(t,[{key:"init",value:function(){var i=this,e=this.config,a=e.serverUrl,t=e.trackers,s=e.session;t.forEach(function(e){var t=e.target,n=e.hit;switch(s&&(e.hit.data?e.hit.data[s]=i.session():e.hit.data=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}({},s,i.session())),t.selectorType){case"direct":if(!t.object)break;new l({targetElement:t.object,eventType:t.eventType,hit:n,serverUrl:a}).apply();break;case"querySelector":for(var r=document.querySelectorAll(t.matcher),o=0;o<r.length;o++)new l({targetElement:r[o],eventType:t.eventType,hit:n,serverUrl:a}).apply()}})}},{key:"session",value:function(){var e=localStorage.getItem("session");if(e)return e;var t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)});return localStorage.setItem("session",t),t}}]),t});
{
"name": "@siteminder/canvas-analytics-js",
"version": "0.3.4",
"version": "0.3.5",
"author": "SiteMinder",

@@ -5,0 +5,0 @@ "publishConfig": {

@@ -89,6 +89,5 @@ <p align="center">

- cd2: propertyId - Hotel/Site unique identifier.
- cd3: sessionId - Session ID generated and stored in localStorage in the browser.
- cd4: host - Property domain/host name. This is derived and passed to GA from Analytics API directly.
- cd3: host - Property domain/host name. This is derived and passed to GA from Analytics API directly.
- cd4: sessionId - Session ID generated and stored in localStorage in the browser.
**Methods**

@@ -95,0 +94,0 @@

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