New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

snowplow-tracker-core

Package Overview
Dependencies
Maintainers
3
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

snowplow-tracker-core - npm Package Compare versions

Comparing version 0.8.0 to 0.9.0-beta.1

dist/cjs/index.d.ts

55

package.json
{
"name": "snowplow-tracker-core",
"version": "0.8.0",
"devDependencies": {
"@types/es6-shim": "0.31.34",
"@types/node": "^9.6.7",
"dts-generator": "^2.0.0",
"grunt": "0.4.5",
"grunt-ts": "5.5.1",
"intern": "3.3.2",
"typescript": "2.2.2"
"version": "0.9.0-beta.1",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"types": "dist/esm/index.d.ts",
"scripts": {
"build": "rollup -c",
"dev": "rollup -c -w",
"test": "ava"
},
"files": [
"dist"
],
"dependencies": {
"@types/uuid": "^2.0.29",
"lodash": "^4.17.11",
"uuid": "2.0.3"
"lodash": "^4.17.20",
"uuid": "^3.3.3"
},
"devDependencies": {
"@types/lodash": "^4.14.160",
"@types/node": "^14.6.0",
"@types/uuid": "^3.4.6",
"@typescript-eslint/eslint-plugin": "^3.10.0",
"@typescript-eslint/parser": "^3.10.0",
"@wessberg/rollup-plugin-ts": "^1.3.3",
"ava": "^3.12.1",
"eslint": "^7.7.0",
"rollup": "^2.26.5",
"ts-node": "^9.0.0",
"tslib": "^2.0.1",
"typescript": "^3.9.7"
},
"contributors": [
"Alex Dean",
"Simon Andersson",
"Fred Blundun"
"Fred Blundun",
"Paul Boocock"
],
"types": "./main.d.ts",
"description": "Core functionality for the Snowplow JavaScript trackers (browser JavaScript; Node.js; Segment.io server-side)",
"description": "Core functionality for the Snowplow JavaScript trackers (Browser, Node.js)",
"repository": {

@@ -36,3 +51,11 @@ "type": "git",

],
"license": "Apache-2.0"
"license": "Apache-2.0",
"ava": {
"extensions": [
"ts"
],
"require": [
"ts-node/register"
]
}
}

@@ -1,5 +0,46 @@

# Snowplow JavaScript Tracker Core [![npm version][npm-image]][npm-url]
# Snowplow JavaScript Tracker Core
Core module to be used by all Snowplow JavaScript trackers.
[![npm version][npm-image]][npm-url]
Core module to be used by Snowplow JavaScript based trackers.
## Developer quickstart
Can be built, tested and packed locally directly with [Node](https://nodejs.org/en/) (10+) and `npm`.
Use `npm install`, `npm run build`, `npm run test` and `npm pack`
Below instructions assume git and [Docker][docker-install] installed.
### Clone repository
```bash
host$ git clone https://github.com/snowplow/snowplow-javascript-tracker.git
```
### Building Tracker Core
```bash
host$ cd snowplow-javascript-tracker/core
host$ docker build -t core .
host$ docker run -v "$(pwd)":"/code" core npm run build
```
### Running tests
```bash
host$ docker run core npm run test
```
### Create NPM Package locally
```bash
host$ docker run -v "$(pwd)":"/code" core npm pack
```
For testing, the resulting tarball `snowplow-tracker-core-x.x.x.tgz` can be installed locally into another application (such as the Snowplow JavaScript Tracker).
```bash
host$ npm install snowplow-tracker-core-x.x.x.tgz
```
## Installation

@@ -13,10 +54,23 @@

## Example
### CommonJS Example
```js
var core = require('snowplow-tracker-core').trackerCore;
const core = require('snowplow-tracker-core').trackerCore;
// Create an instance with base 64 encoding set to false (it defaults to true)
var coreInstance = core(false);
const coreInstance = core(false);
```
### ES Module Example
```js
import { trackerCore } from 'snowplow-tracker-core';
// Create an instance with base 64 encoding set to false (it defaults to true)
const coreInstance = trackerCore(false)
```
### Example
```js
// Add a name-value pair to all payloads

@@ -27,4 +81,4 @@ coreInstance.addPayloadPair('vid', 2);

coreInstance.addPayloadDict({
'ds': '1160x620',
'fp': 4070134789
'ds': '1160x620',
'fp': 4070134789
});

@@ -41,3 +95,3 @@

// Track a page view with URL and title
var pageViewPayload = coreInstance.trackPageView('http://www.example.com', 'landing page');
const pageViewPayload = coreInstance.trackPageView('http://www.example.com', 'landing page');

@@ -47,16 +101,16 @@ console.log(pageViewPayload.build());

{
'e': 'pv',
'url': 'http://www.example.com',
'page': 'landing page',
'uid': 'user-321',
'vd': 2,
'ds': '1160x620',
'fp': 4070134789
'tv': 'js-3.0.0',
'p': 'web',
'cd': 24,
'vp': '600x400',
'ua': 'Snowplow/0.0.1',
'dtm': 1406879959702, // timestamp
'eid': '0718a85a-45dc-4f71-a949-27870442ed7d' // UUID
'e': 'pv',
'url': 'http://www.example.com',
'page': 'landing page',
'uid': 'user-321',
'vd': 2,
'ds': '1160x620',
'fp': 4070134789
'tv': 'js-3.0.0',
'p': 'web',
'cd': 24,
'vp': '600x400',
'ua': 'Snowplow/0.0.1',
'dtm': 1406879959702, // timestamp
'eid': '0718a85a-45dc-4f71-a949-27870442ed7d' // UUID
}

@@ -69,8 +123,8 @@ */

// Track an unstructured event
var unstructEventPayload = coreInstance.trackUnstructEvent({
'schema': 'iglu:com.snowplowanalytics.snowplow/link_click/jsonschema/1-0-0',
'data': {
'targetUrl': 'http://www.destination.com',
'elementId': 'bannerLink'
}
const unstructEventPayload = coreInstance.trackUnstructEvent({
'schema': 'iglu:com.snowplowanalytics.snowplow/link_click/jsonschema/1-0-0',
'data': {
'targetUrl': 'http://www.destination.com',
'elementId': 'bannerLink'
}
});

@@ -81,15 +135,15 @@

{
'e': 'ue',
'ue_pr': {
'schema': 'iglu:com.snowplowanalytics.snowplow/unstruct_even/jsonschema/1-0-0',
'data': {
'schema': 'iglu:com.snowplowanalytics.snowplow/link_click/jsonschema/1-0-0',
'data': {
'targetUrl': 'http://www.destination.com',
'elementId': 'bannerLink'
}
}
},
'dtm': 1406879973439,
'eid': '956c6670-cbf6-460b-9f96-143e0320fdf6'
'e': 'ue',
'ue_pr': {
'schema': 'iglu:com.snowplowanalytics.snowplow/unstruct_even/jsonschema/1-0-0',
'data': {
'schema': 'iglu:com.snowplowanalytics.snowplow/link_click/jsonschema/1-0-0',
'data': {
'targetUrl': 'http://www.destination.com',
'elementId': 'bannerLink'
}
}
},
'dtm': 1406879973439,
'eid': '956c6670-cbf6-460b-9f96-143e0320fdf6'
}

@@ -104,3 +158,3 @@ */

```js
var coreInstance = core(true, console.log);
const coreInstance = core(true, console.log);
```

@@ -113,6 +167,4 @@

```js
var core = require('snowplow-tracker-core');
const coreInstance = core(); // Base 64 encoding on by default
var coreInstance = core(); // Base 64 encoding on by default
coreInstance.setBase64Encoding(false); // Base 64 encoding is now off

@@ -143,1 +195,2 @@ ```

[wiki]: https://github.com/snowplow/snowplow/wiki/Javascript-Tracker-Core
[docker-install]: https://docs.docker.com/install/
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