Skip to content

Commit

Permalink
ADD try-catch
Browse files Browse the repository at this point in the history
  • Loading branch information
pubkey committed Mar 12, 2024
1 parent fca84fe commit 7bf3913
Showing 1 changed file with 23 additions and 12 deletions.
35 changes: 23 additions & 12 deletions docs-src/static/js/analytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,33 @@ function trigger(type, value) {

// reddit
if (typeof window.rdt === 'function') {
window.rdt('track', 'Lead', {
transactionId: type + '-' + new Date().getTime(),
value: value
});
try {
window.rdt('track', 'Lead', {
transactionId: type + '-' + new Date().getTime(),
currency: 'EUR',
value: value
});
} catch (err) {
console.log('# Error on reddit trigger:');
console.dir(err);
}
}

// google analytics
if (typeof window.gtag === 'function') {
window.gtag(
'event',
type,
{
value,
currency: 'EUR'
}
);
try {
window.gtag(
'event',
type,
{
value,
currency: 'EUR'
}
);
} catch (err) {
console.log('# Error on google trigger:');
console.dir(err);
}
}
}
window.trigger = trigger;
Expand Down

0 comments on commit 7bf3913

Please sign in to comment.