Skip to content

Commit

Permalink
Merge pull request #307 from CaptainFact/chore/matomo
Browse files Browse the repository at this point in the history
Ignore Matomo errors
  • Loading branch information
Betree committed Dec 8, 2018
2 parents ffe9774 + 8840c6d commit 4584f59
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions app/API/matomo.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,25 @@ import { IS_DEV } from '../config'
* @param {number} (optional) numeric value
*/
export const pushEvent = (context, action, name, value) => {
// Generate the event
let event = null
if (name && value) {
event = ['trackEvent', context, action, name, value]
} else if (name) {
event = ['trackEvent', context, action, name]
} else {
event = ['trackEvent', context, action]
}
try {
// Generate the event
let event = null
if (name && value) {
event = ['trackEvent', context, action, name, value]
} else if (name) {
event = ['trackEvent', context, action, name]
} else {
event = ['trackEvent', context, action]
}

// Push the event
if ((window._paq === undefined || !window._paq) && IS_DEV) {
console.debug('[Matomo] Push event', event)
} else {
window._paq.push(event)
// Push the event
if ((window._paq === undefined || !window._paq) && IS_DEV) {
console.debug('[Matomo] Push event', event)
} else {
window._paq.push(event)
}
} catch (e) {
// Ignore errors
}
}

Expand Down

0 comments on commit 4584f59

Please sign in to comment.