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

keen-tracking

Package Overview
Dependencies
Maintainers
2
Versions
70
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

keen-tracking - npm Package Compare versions

Comparing version 1.4.1 to 1.4.2

10

lib/browser-auto-tracking.js

@@ -25,7 +25,7 @@ var pkg = require('../package.json');

uuid = helpers.getUniqueId();
var domainName = helpers.getDomainName(window.location.host);
cookie.set('uuid', uuid,
domainName && options.shareUuidAcrossDomains ? {
domain: '.' + domainName
} : {});
var domainName = helpers.getDomainName(window.location.hostname);
var cookieDomain = domainName && options.shareUuidAcrossDomains ? {
domain: '.' + domainName
} : {};
cookie.set('uuid', uuid, cookieDomain);
}

@@ -32,0 +32,0 @@

@@ -1,6 +0,39 @@

function getDomainName(host){
var domainRegex = /\w+\.\w+$/;
return domainRegex.test(host) ? host.match(domainRegex)[0] : null;
function extractHostname(url) {
var hostname;
//find & remove protocol (http, ftp, etc.) and get hostname
if (url.indexOf("://") > -1) {
hostname = url.split('/')[2];
}
else {
hostname = url.split('/')[0];
}
//find & remove port number
hostname = hostname.split(':')[0];
//find & remove "?"
hostname = hostname.split('?')[0];
return hostname;
}
// To address those who want the "root domain," use this function:
function getDomainName(url) {
var domain = extractHostname(url),
splitArr = domain.split('.'),
arrLen = splitArr.length;
//extracting the root domain here
//if there is a subdomain
if (arrLen > 2) {
domain = splitArr[arrLen - 2] + '.' + splitArr[arrLen - 1];
//check to see if it's using a Country Code Top Level Domain (ccTLD) (i.e. ".me.uk")
if (splitArr[arrLen - 2].length == 2 && splitArr[arrLen - 1].length == 2) {
//this is using a ccTLD
domain = splitArr[arrLen - 3] + '.' + domain;
}
}
return domain;
}
module.exports = getDomainName;

@@ -36,5 +36,5 @@ var Cookies = require('js-cookie');

cookie.prototype.set = function(str, value){
cookie.prototype.set = function(str, value, options){
if (!arguments.length || !this.enabled()) return this;
if (typeof str === 'string' && arguments.length === 2) {
if (typeof str === 'string' && arguments.length >= 2) {
this.data[str] = value ? value : null;

@@ -45,3 +45,3 @@ }

}
Cookies.set(this.config.key, this.data, this.config.options);
Cookies.set(this.config.key, this.data, extend(this.config.options, options || {}));
return this;

@@ -48,0 +48,0 @@ };

{
"name": "keen-tracking",
"version": "1.4.1",
"version": "1.4.2",
"description": "Data Collection SDK for Keen IO",

@@ -5,0 +5,0 @@ "main": "lib/server.js",

@@ -14,3 +14,3 @@ # keen-tracking.js [![Build Status](https://travis-ci.org/keen/keen-tracking.js.svg?branch=master)](https://travis-ci.org/keen/keen-tracking.js)

```html
<script src="https://d26b395fwzu5fz.cloudfront.net/keen-tracking-1.4.1.min.js"></script>
<script src="https://d26b395fwzu5fz.cloudfront.net/keen-tracking-1.4.2.min.js"></script>
```

@@ -50,3 +50,3 @@

```html
<script src="https://d26b395fwzu5fz.cloudfront.net/keen-tracking-1.4.0.min.js"></script>
<script src="https://d26b395fwzu5fz.cloudfront.net/keen-tracking-1.4.2.min.js"></script>
<script>

@@ -53,0 +53,0 @@ Keen.ready(function(){

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