Socket
Book a DemoInstallSign in
Socket

@daisycon/tracking

Package Overview
Dependencies
Maintainers
5
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@daisycon/tracking - npm Package Compare versions

Comparing version

to
0.0.4

lib/build/daisycon-bundle.min.js

26

package.json
{
"author": "Daisycon B.V.",
"bugs": {
"url": "https://github.com/DaisyconBV/daisycon-tracking/issues"
"url": "https://github.com/DaisyconBV/js-tracking/issues"
},

@@ -15,10 +15,19 @@ "description": "Daisycon JS tracking",

"ts-jest": "27.0.4",
"ts-loader": "^9.2.4",
"tscpaths": "^0.0.9",
"tslint": "6.1.3",
"typescript": "4.3.5"
"typescript": "4.3.5",
"webpack": "^5.46.0",
"webpack-cli": "^4.7.2"
},
"exports": {
".": {
"import": "./lib/ejs/index.js",
"require": "./lib/cjs/index.js"
}
},
"files": [
"lib/**/*"
],
"homepage": "https://github.com/DaisyconBV/daisycon-tracking#readme",
"homepage": "https://github.com/DaisyconBV/js-tracking#readme",
"keywords": [

@@ -29,11 +38,12 @@ "Daisycon",

"license": "ISC",
"main": "lib/index.js",
"main": "lib/cjs/index.js",
"module": "lib/ejs/index.js",
"name": "@daisycon/tracking",
"repository": {
"type": "git",
"url": "git+https://github.com/DaisyconBV/daisycon-tracking.git"
"url": "git+https://github.com/DaisyconBV/js-tracking.git"
},
"scripts": {
"prebuild": "node -p \"'export const LIB_VERSION: string = \\'' + require('./package.json').version + '\\';'\" > src/version.ts",
"build": "tsc -p tsconfig.json && tscpaths -p tsconfig.json -s ./src -o ./lib",
"build": "rm -rf ./lib && tsc -p tsconfig-es6.json && tscpaths -p tsconfig-es6.json -s ./src -o ./lib/es6 && tsc -p tsconfig-cjs.json && tscpaths -p tsconfig-cjs.json -s ./src -o ./lib/cjs && ./create-package-json.sh && webpack --mode production",
"lint": "tslint -p tsconfig.json",

@@ -44,6 +54,6 @@ "postversion": "git push && git push --tags",

"preversion": "npm run lint",
"test": "jest --config jestconfig.json"
"test": "jest --config jestconfig.json --verbose"
},
"types": "lib/index.d.ts",
"version": "0.0.3"
"version": "0.0.4"
}

@@ -15,3 +15,3 @@ # Daisycon JS Tracking

## Usage
## Recommended usage (es6)

@@ -24,3 +24,3 @@ ### Storing incoming requests

new TrackingService('dt51.net')
new TrackingService()
.storeData();

@@ -122,1 +122,83 @@ ```

```
## Alternate usage (commonjs)
### Storing incoming requests
Add the following piece of code to the root of your app so that it loads on every page and stores any received dci.
```typescript
const daisycon = require('@daisycon/tracking');
new daisycon.TrackingService()
.storeData();
```
### Registering sale/lead
#### async await method
```typescript
const daisycon = require('@daisycon/tracking');
const campaignId: number = 475;
const segment: string = 'lt45.net';
const transaction: daisycon.Transaction = new daisycon.Transaction({
campaignId: campaignId,
transactionId: 'AB374782388282',
}).addPart(new daisycon.Part({
amount: 125,
revenue: 250,
currency: daisycon.CurrencyEnum.EUR,
externalDescription: 'Transaction for Campaign',
}));
try {
const successResponse: SuccessInterface = await new daisycon.TrackingService(segment)
.registerTransaction(transaction);
console.log('successResponse', successResponse);
} catch (errorResponse: any) {
console.log('errorResponse', errorResponse);
}
```
## Alternate usage manual import
### Storing incoming requests
Add the following piece of code to the root of your app so that it loads on every page and stores any received dci.
```html
<script src="/path/to/build/daisycon-bundle.min.js"
```
```javascript
new daisycon()
.storeData();
```
### Registering sale/lead
#### async await method
```javascript
const campaignId: number = 475;
const segment: string = 'lt45.net';
try {
const successResponse = new daisycon(segment)
.registerTransaction({
campaignId: campaignId,
transactionId: 'AB374782388282',
parts: [{
amount: 125,
revenue: 250,
currency: daisycon.CurrencyEnum.EUR,
externalDescription: 'Transaction for Campaign',
}]
});
console.log('successResponse', successResponse);
} catch (errorResponse: any) {
console.log('errorResponse', errorResponse);
}
```