-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- added configuration options `metrics.events` and `metrics.params` - removed configuration option `metrics.disabledEvents` - events can be now disabled also via the option `metrics.events` - updated docs - updated changelog
- Loading branch information
Showing
10 changed files
with
264 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { Events } from './events.mjs'; | ||
|
||
export class EventsConfig { | ||
constructor(config) { | ||
const events = {}; | ||
events[Events.BANNER_LOADED] = Events.BANNER_LOADED; | ||
events[Events.BANNER_DISPLAYED] = Events.BANNER_DISPLAYED; | ||
events[Events.BANNER_FULLY_DISPLAYED] = Events.BANNER_FULLY_DISPLAYED; | ||
events[Events.BANNER_CLICKED] = Events.BANNER_CLICKED; | ||
events[Events.BANNER_CLOSED] = Events.BANNER_CLOSED; | ||
|
||
const params = { | ||
channel_code: 'channel_code', | ||
banner_id: 'banner_id', | ||
banner_name: 'banner_name', | ||
position_id: 'position_id', | ||
position_code: 'position_code', | ||
position_name: 'position_name', | ||
campaign_id: 'campaign_id', | ||
campaign_code: 'campaign_code', | ||
campaign_name: 'campaign_name', | ||
breakpoint: 'breakpoint', | ||
link: 'link', | ||
}; | ||
|
||
if ('events' in config) { | ||
for (let eventKey in config.events) { | ||
const eventValue = config.events[eventKey]; | ||
|
||
if (true === eventValue || !(eventKey in events)) { | ||
continue; | ||
} | ||
|
||
if (false === eventValue || 'string' === typeof eventValue) { | ||
events[eventKey] = eventValue; | ||
} | ||
} | ||
} | ||
|
||
if ('params' in config) { | ||
for (let paramKey in config.params) { | ||
if (paramKey in params && 'string' === typeof config.params[paramKey]) { | ||
params[paramKey] = config.params[paramKey]; | ||
} | ||
} | ||
} | ||
|
||
this.events = events; | ||
this.params = params; | ||
} | ||
} |
Oops, something went wrong.