Skip to content

Commit

Permalink
fix(matomo): add event action blacklist
Browse files Browse the repository at this point in the history
  • Loading branch information
Philip London committed May 4, 2020
1 parent 4786784 commit b5250f9
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ const TYPE_WHITELIST = [
'SHOW_MODAL'
]

const EVENT_ACTION_BLACKLIST = ['ShowXPub']

let lastEvent = []

const formatEvent = x => (typeof x !== 'string' ? JSON.stringify(x) : x)
Expand All @@ -52,7 +54,11 @@ const matomoMiddleware = () => store => next => action => {
const logEvent = includes(action.type, TYPE_WHITELIST)
const nextEvent = [eventCategory, eventAction, eventName]

if (logEvent && !equals(nextEvent, lastEvent)) {
if (
logEvent &&
!equals(nextEvent, lastEvent) &&
!includes(eventAction, EVENT_ACTION_BLACKLIST)
) {
const frame = document.getElementById('matomo-iframe')
frame &&
frame.contentWindow &&
Expand Down

0 comments on commit b5250f9

Please sign in to comment.