@daisycon/tracking
Advanced tools
Comparing version
{ | ||
"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); | ||
} | ||
``` |
AI-detected potential malware
Supply chain riskAI has identified this package as malware. This is a strong signal that the package may be malicious.
Found 2 instances in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
126287
110.56%119
112.5%2308
105.52%202
68.33%12
33.33%2
Infinity%1
Infinity%