@adv-jobs/ij-segment-wrapper
v3.15.0
Published
[](https://travis.mpi-internal.com/scmspain/frontend-ij--segment-wrapper) ;
script.src = 'http://localhost:5000/index.js'
body.append(script)You can also test the library by publishing a new beta version. In order to do that:
- Put the -beta.0 suffix to your version
"version": "1.50.0-beta.0",- Execute the publish command
> npm publish --tag beta- Check this url https://unpkg.com/@adv-jobs/ij-segment-wrapper@beta/umd/index.js. In few minutes, it should be redirect to your beta version. In our case:
https://unpkg.com/@adv-jobs/ij-segment-wrapper@beta/umd/index.jsRelease a new version
Once you have merged your changes, the @s-ui/ci tool will automatically release your component. Once this step is completed https://unpkg.com/@adv-jobs/ij-segment-wrapper/umd/index.js will need up to 20 minutes to update its cdn's cache and start deliver the new version.
Migration to v2
In the v2 version, the entryPoint is not automatically invoked inside the library, but you need to import and call it when loading your app.
import {entryPoint, makeGtmMiddleware} from '@adv-jobs/ij-segment-wrapper'
if (process.env.NODE_ENV !== 'test') {
entryPoint({customSourceMiddlewares})
}In some cases, you may want to also apply custom source middlewares. In this case, it is possible to pass an array of custom middlewares (be careful, custom destination middlewares are not supported yet in this library version) as shown in this example:
import {entryPoint, makeGtmMiddleware} from '@adv-jobs/ij-segment-wrapper'
const customSourceMiddlewares = [makeGtmMiddleware()]
if (process.env.NODE_ENV !== 'test') {
entryPoint({customSourceMiddlewares})
}The makeGtmMiddleware is a factory function that applies a gtmMiddleware, which forwards events only to the Google Tag Manager destination under specific conditions (you probably won't need to use it).
In case of exceptional need, is possible to whitelist some events with this middleware and threat them as usual:
import {entryPoint, makeGtmMiddleware} from '@adv-jobs/ij-segment-wrapper'
const whitelist = [
'MyCv Experience Form Viewed'
]
const customSourceMiddlewares = [makeGtmMiddleware({whitelist})]
if (process.env.NODE_ENV !== 'test') {
entryPoint({customSourceMiddlewares})
}Breaking changes
- The entrypoint is not automatically invoked, you need to import it from the library and call it manually to initialize the segment wrapper.
