Socket
Socket
Sign inDemoInstall

@schibsted/niche-tracking

Package Overview
Dependencies
0
Maintainers
4
Versions
38
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.1.0 to 4.0.0

8

dist/index.js

@@ -24,8 +24,2 @@ "use strict";

});
Object.defineProperty(exports, "linkpulse", {
enumerable: true,
get: function () {
return _linkpulse.default;
}
});
Object.defineProperty(exports, "mbl", {

@@ -44,6 +38,4 @@ enumerable: true,

var _linkpulse = _interopRequireDefault(require("./linkpulse"));
var _mbl = _interopRequireDefault(require("./mbl"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

12

package.json
{
"name": "@schibsted/niche-tracking",
"version": "3.1.0",
"version": "4.0.0",
"description": "Package containing tracking logic reused between multiple Schibsted niche sites",

@@ -47,10 +47,10 @@ "main": "dist/index.js",

"babel-eslint": "^10.1.0",
"eslint": "^7.16.0",
"eslint": "^7.21.0",
"eslint-config-airbnb-base": "^14.2.1",
"eslint-config-prettier": "^7.1.0",
"eslint-config-prettier": "^7.2.0",
"eslint-plugin-babel": "^5.3.1",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-prettier": "^3.3.0",
"husky": "4.3.7",
"lint-staged": "10.5.3",
"eslint-plugin-prettier": "^3.3.1",
"husky": "4.3.8",
"lint-staged": "10.5.4",
"prettier": "^2.2.1",

@@ -57,0 +57,0 @@ "rimraf": "^3.0.2"

# Niche Tracking
## Description
This repository contains code we use for tracking. The goal of niche-tracking is to be used in all of our products, however currently it's used only for [tek-web](https://github.schibsted.io/niche-and-services/tek-web).
This repository contains code we use for tracking. The goal of niche-tracking is to be used in all of our products. Currently it's used by [tek-web](https://github.schibsted.io/niche-and-services/tek-web), [godt-web](https://github.schibsted.io/niche-and-services/godt2-web) and [pent-web](https://github.schibsted.io/niche-and-services/pent2-web).

@@ -20,4 +20,7 @@ ## Local development

Make your project available as package locally:
### Linking
Note: order of command execution is important.
In order to make your project available as package locally:
```bash

@@ -35,4 +38,16 @@ npm link

### Unlinking
After you end working on the package you need to unlink it.
First, in the project where the package was used:
```bash
npm unlink --no-save @schibsted/niche-tracking
```
Second, in the niche-tracking package:
```bash
npm unlink
```
## Supported trackers
Currently pulse, google analytics and linkpulse trackers are implemented.
Currently pulse, google analytics and mbl trackers are implemented.

@@ -43,3 +58,3 @@ ## How to use it and how it works

```javascript
import { Tracker, pulse } from '@schibsted/niche-tracking';
import { Tracker, pulse, googleAnalytics, mbl } from '@schibsted/niche-tracking';
```

@@ -56,3 +71,3 @@

mutateScript,
trackers: [pulse],
trackers: [pulse, googleAnalytics, mbl],
});

@@ -67,3 +82,3 @@ ```

- [google analytics](./src/googleAnalytics/README.md)
- [linkpulse](./src/linkpulse/README.md)
- [mbl](./src/mbl/README.md)

@@ -109,19 +124,19 @@ Let's discuss Tracker constructor parameters

object: {
id: 'sectionScreen',
name: window.document.title,
id: options.category,
type: 'Listing',
category: options.type === 'guide' ? 'reise>byguide' : 'reise',
category: options.category,
filters: {
query: `?page=${options.pagination}`,
query: options.location.search,
},
name: options.title,
},
}),
linkpulse: options => ({
contentType: 'Sectionpage',
pagination: options.pagination,
url: getCurrentUrl(),
referer: options.appReferrer,
googleAnalytics: options => ({
page_path: options.location.pathname,
}),
googleAnalytics: options => ({
pathname: options.pathname,
mbl: options => ({
url: window.location.toString(),
title: window.document.title,
image: options.image.url,
referrer: document.referrer
})

@@ -140,3 +155,3 @@ }

mutateScript,
trackers: [pulse, linkpulse, googleAnalytics],
trackers: [pulse, googleAnalytics, mbl],
});

@@ -147,7 +162,8 @@ ```

- pulseSpecificOptions,
- linkpulseSpecificOptions,
- googleAnalyticsSpecificOptions
- mblSpecificOptions
according to transform functions you provided in `pageViewTrackerMappers`.
Next it will call `pulse.pagewiew(pulseSpecificOptions)`, `linkpulse.pageView(linkpulseSpecificOptions)`, `googleAnalytics.pageView(googleAnalyticsSpecificOptions)`.
Next it will call `pulse.pagewiew(pulseSpecificOptions)`, `googleAnalytics.pageView(googleAnalyticsSpecificOptions)`, `mbl.pagewiew(mblSpecificOptions)`.

@@ -207,2 +223,2 @@ As you can see it enables you to implement most of the tracking in declarative way. All you need is choose which trackers you need and provide proper options mapping.

## Useful links
To get more general idea of how tracking works check our [team docs](https://github.schibsted.io/niche-and-services/team/blob/master/docs/tracking.md)
To get more general idea of how tracking works check our [team docs](https://pages.github.schibsted.io/niche-and-services/team/tracking)

@@ -16,3 +16,3 @@ # Google analytics tracker

mutateScript,
trackers: [pulse, linkpulse, googleAnalytics],
trackers: [pulse, googleAnalytics],
googleAnalytics: {

@@ -19,0 +19,0 @@ options: {

import Tracker from './tracker';
import pulse from './pulse';
import googleAnalytics from './googleAnalytics';
import linkpulse from './linkpulse';
import mbl from './mbl';
export { Tracker, pulse, googleAnalytics, linkpulse, mbl };
export { Tracker, pulse, googleAnalytics, mbl };

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

# Linkpulse MBL tracker
# MBL tracker
This is a separate minimalistic tracker based on linkpulse.
This is a separate minimalistic tracker based on old linkpulse tracker.

@@ -5,0 +5,0 @@ ## Config

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc