@dudadev/tracking
Advanced tools
Comparing version 1.1.1 to 1.1.2
const commonProps = require('@dudadev/common-props'); | ||
exports.HS_ID = commonProps.get('hubspot.events.api.id'); | ||
exports.isHubspotUserIdentified = false; | ||
exports.sendHubspotEvent = async function (eventName) { | ||
if (commonProps.getFlag('pricing.hubspotEvents.enabled')) { | ||
if (commonProps.getFlag('pricing.hubspotEvents.enabled') && window._account.isAccountOwnerHubspotUser) { | ||
await exports.initHubspotEvents(); | ||
@@ -13,3 +14,3 @@ exports.pushEvent(eventName); | ||
exports.initHubspotEvents = function () { | ||
console.log('window.dm_account_email', window.dm_account_email); | ||
console.log('window._account.email', window._account.email); | ||
if (window._hsq) { | ||
@@ -24,2 +25,11 @@ return Promise.resolve(window._hsq); | ||
console.log('pushEvent', eventName); | ||
if (!exports.isHubspotUserIdentified) { | ||
window._hsq.push([ | ||
'identify', | ||
{ | ||
email: window._account.email, | ||
}, | ||
]); | ||
exports.isHubspotUserIdentified = true; | ||
} | ||
window._hsq.push([ | ||
@@ -26,0 +36,0 @@ 'trackEvent', |
{ | ||
"name": "@dudadev/tracking", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "Module for tracking events", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
3421
96