@evolv-delivery/device-data-pdp
v0.4.2
Published
Captures a value on one page and binds it to the remote context on another page
Downloads
37
Keywords
Readme
Example Audience Integration
Created for experiment DP Nudge
Sets sessionStorage item on /example/page/1 of evolv:example-value containing exampleValue.
Reads evolv:example-value on /example/page/2, setting boolean remoteContext entries for vz.exampleValue.
Setup
To create new-integration from this template in your /evolv/env-integrations folder:
rsync -av templates/ new-integrationAnd then customize your package.json, src/index.js, and README.md to fit your project
NPM scripts
| | |
| :---------------- | :--------------------------------------------- |
| npm run build | Builds dist/../index.js files |
| npm run watch | Automatically builds on save of src/index.js |
| npm run serve | Hosts dist folder on port 8080 |
| npm run dev | Watch and serve |
| npm start | Same as npm run dev |
| npm run publish | Build and publish to npm |
Local Hosting
Run npm start to host locally. To run in your browser inject the following into your <head> tag using Resource Override
(() => {
if (window.self !== window.top) return;
console.log('[evolv-local] example-integration: inject');
const script = document.createElement('script');
script.type = 'module';
script.text =
'import integration from "http://localhost:8080/dist/es/index.js"; console.log("[evolv-local] example-integration: load"); integration()';
document.head.appendChild(script);
})();