Ads Event Tracking
npm install sdkblm-tracking-js``bash`
npm install --save sdkblm-tracking-js
Call the sdk blm js library in our project
`html`
Instantiate the class to be able to use the methods as required
`js`
const sdk = new sdkblm.events(document.getElementById('adsJson').value);
Once we instantiate our sdkblmTracking class we can call the methods
getAds
This method returns the called json structure and adds the time in milliseconds at each required level, adding the elements startTimeInMiliSeconds and durationInMiliSeconds
`js`
const ads = await sdk.getAds();
getAvailPosition
This method will return the avails object that corresponds to the time parameter based on startTime and endTime, endTime is calculated by adding starTime and the duration of the ad
@param int time
`js`
const avail = await sdk.getAvailPosition(time);
sendEvent
This method will return the elements contained in trackingEvents that correspond to the current time of the player and the perse event.
In addition, it performs the fetch action to each beacon Url contained in the response except for the clickThrough event in which case it will only return the object
@param int time
@param string action
`js`
const objavails = await sdk.sendEvent(time, actiontype);
Below we can see an example of the implementation of the class
`html
``