Modules
module-pixel
Pixel module allows injecting a script or HTML element into the page in a browser environment via effects.
Installation#
Install with npm in your application:
Command
$ npm install --save \ @eventvisor/sdk \ @eventvisor/module-pixel
Setting up#
And then set it up when initializing the SDK:
import { createInstance } from "@eventvisor/sdk";import { createPixelModule } from "@eventvisor/module-pixel";const eventvisor = createInstance({ modules: [ createPixelModule(), ]});
Usage example#
In your effect definition:
effects/myEffect.yml
# ...steps: - handler: pixel params: snippet: | <script> console.log("Hello world!"); </script> selector: body
Variables#
You can make use of sources in pixel's snippet as variables:
<script> console.log("Hello world from {{ payload.url }}");</script>