@analytics/hubspot
Advanced tools
Comparing version 0.4.0 to 0.5.0
@@ -6,2 +6,13 @@ # Change Log | ||
# [0.5.0](https://github.com/DavidWells/analytics/compare/@analytics/hubspot@0.4.0...@analytics/hubspot@0.5.0) (2021-02-12) | ||
### Features | ||
* add flushOnIdentify to immediately identify in hubspot ([79696a0](https://github.com/DavidWells/analytics/commit/79696a0)) | ||
# [0.4.0](https://github.com/DavidWells/analytics/compare/@analytics/hubspot@0.3.1...@analytics/hubspot@0.4.0) (2021-02-12) | ||
@@ -8,0 +19,0 @@ |
@@ -119,5 +119,11 @@ var analyticsHubspot = (function () { | ||
var properties = formatTraits(traits, userId, defaultFormatter); | ||
var properties = formatTraits(traits, userId, defaultFormatter); // Identify will send with next event or page view. | ||
_hsq.push(['identify', properties]); | ||
_hsq.push(['identify', properties]); // Fire without a hard reload or SPA routing | ||
if (config.flushOnIdentify) { | ||
// Hack to flush identify call immediately. | ||
_hsq.push(['trackPageView']); | ||
} | ||
}, | ||
@@ -124,0 +130,0 @@ |
@@ -1,1 +0,1 @@ | ||
var analyticsHubspot=function(){"use strict";function t(t,n){return function(t){if(Array.isArray(t))return t}(t)||function(t,n){var e=[],r=!0,i=!1,o=void 0;try{for(var s,a=t[Symbol.iterator]();!(r=(s=a.next()).done)&&(e.push(s.value),!n||e.length!==n);r=!0);}catch(t){i=!0,o=t}finally{try{r||null==a.return||a.return()}finally{if(i)throw o}}return e}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function n(t,n){var e=function(t){return t.split(/(?=[A-Z])/).join("_").toLowerCase()}(t.split(" ").join("_").split(".").join("_").split("\n").join("_").split("\v").join("_").split("\t").join("_").split("\f").join("_").split("\r").join("_"));return"first_name"===e||"last_name"===e?[e.replace(/_/,""),n]:[e,n]}return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=!1;return{name:"hubspot",config:e,initialize:function(t){var n=t.config,e=n.portalId,r=n.customScriptSrc;if(!e)throw new Error("No hubspot portalId defined");if(i=document.getElementsByTagName("script"),!Object.keys(i).filter(function(t){var n=i[t]||{},e=n.src||"";return e.match(/js\.hs-scripts\.com/)}).length){var i,o=document.location.protocol,s="https:"===o||"chrome-extension:"===o,a=Math.floor((new Date).getTime()/36e5),c=r||"".concat(s?"https:":"http:","//js.hs-scripts.com/").concat(e,".js"),u="".concat(c,"?").concat(a),p=document.createElement("script");p.id="hs-script-loader",p.type="text/javascript",p.async=!0,p.src=u,setTimeout(function(){var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(p,t)},0)}},identify:function(e){var r=e.payload,i=(e.config,r.userId),o=r.traits;if("undefined"!=typeof _hsq&&o.email){var s=function(n,e,r){var i=Object.keys(n).reduce(function(e,i){var o=r(i,n[i]),s=t(o,2),a=s[0],c=s[1];return e[a]=c,e},{});return e&&!i.id&&(i.id=e),i}(o,i,n);_hsq.push(["identify",s])}},page:function(t){var n=t.payload;t.options,t.instance,"undefined"!=typeof _hsq&&(r?(_hsq.push(["setPath",n.properties.path]),_hsq.push(["trackPageView"])):r=!0)},track:function(t){var n=t.payload;if(t.options,t.config,"undefined"!=typeof _hsq){var e=Object.assign({},n.properties,{id:n.event});_hsq.push(["trackEvent",e])}},reset:function(){"undefined"!=typeof _hsq&&_hsp.push(["revokeCookieConsent"])},loaded:function(){return!(!window._hsq||window._hsq.push===Array.prototype.push)}}}}(); | ||
var analyticsHubspot=function(){"use strict";function t(t,n){return function(t){if(Array.isArray(t))return t}(t)||function(t,n){var e=[],r=!0,i=!1,o=void 0;try{for(var s,a=t[Symbol.iterator]();!(r=(s=a.next()).done)&&(e.push(s.value),!n||e.length!==n);r=!0);}catch(t){i=!0,o=t}finally{try{r||null==a.return||a.return()}finally{if(i)throw o}}return e}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function n(t,n){var e=function(t){return t.split(/(?=[A-Z])/).join("_").toLowerCase()}(t.split(" ").join("_").split(".").join("_").split("\n").join("_").split("\v").join("_").split("\t").join("_").split("\f").join("_").split("\r").join("_"));return"first_name"===e||"last_name"===e?[e.replace(/_/,""),n]:[e,n]}return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=!1;return{name:"hubspot",config:e,initialize:function(t){var n=t.config,e=n.portalId,r=n.customScriptSrc;if(!e)throw new Error("No hubspot portalId defined");if(i=document.getElementsByTagName("script"),!Object.keys(i).filter(function(t){var n=i[t]||{},e=n.src||"";return e.match(/js\.hs-scripts\.com/)}).length){var i,o=document.location.protocol,s="https:"===o||"chrome-extension:"===o,a=Math.floor((new Date).getTime()/36e5),c=r||"".concat(s?"https:":"http:","//js.hs-scripts.com/").concat(e,".js"),u="".concat(c,"?").concat(a),p=document.createElement("script");p.id="hs-script-loader",p.type="text/javascript",p.async=!0,p.src=u,setTimeout(function(){var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(p,t)},0)}},identify:function(e){var r=e.payload,i=e.config,o=r.userId,s=r.traits;if("undefined"!=typeof _hsq&&s.email){var a=function(n,e,r){var i=Object.keys(n).reduce(function(e,i){var o=r(i,n[i]),s=t(o,2),a=s[0],c=s[1];return e[a]=c,e},{});return e&&!i.id&&(i.id=e),i}(s,o,n);_hsq.push(["identify",a]),i.flushOnIdentify&&_hsq.push(["trackPageView"])}},page:function(t){var n=t.payload;t.options,t.instance,"undefined"!=typeof _hsq&&(r?(_hsq.push(["setPath",n.properties.path]),_hsq.push(["trackPageView"])):r=!0)},track:function(t){var n=t.payload;if(t.options,t.config,"undefined"!=typeof _hsq){var e=Object.assign({},n.properties,{id:n.event});_hsq.push(["trackEvent",e])}},reset:function(){"undefined"!=typeof _hsq&&_hsp.push(["revokeCookieConsent"])},loaded:function(){return!(!window._hsq||window._hsq.push===Array.prototype.push)}}}}(); |
@@ -118,5 +118,11 @@ 'use strict'; | ||
var properties = formatTraits(traits, userId, defaultFormatter); | ||
var properties = formatTraits(traits, userId, defaultFormatter); // Identify will send with next event or page view. | ||
_hsq.push(['identify', properties]); | ||
_hsq.push(['identify', properties]); // Fire without a hard reload or SPA routing | ||
if (config.flushOnIdentify) { | ||
// Hack to flush identify call immediately. | ||
_hsq.push(['trackPageView']); | ||
} | ||
}, | ||
@@ -123,0 +129,0 @@ |
@@ -116,5 +116,11 @@ function _slicedToArray(arr, i) { | ||
var properties = formatTraits(traits, userId, defaultFormatter); | ||
var properties = formatTraits(traits, userId, defaultFormatter); // Identify will send with next event or page view. | ||
_hsq.push(['identify', properties]); | ||
_hsq.push(['identify', properties]); // Fire without a hard reload or SPA routing | ||
if (config.flushOnIdentify) { | ||
// Hack to flush identify call immediately. | ||
_hsq.push(['trackPageView']); | ||
} | ||
}, | ||
@@ -121,0 +127,0 @@ |
{ | ||
"name": "@analytics/hubspot", | ||
"version": "0.4.0", | ||
"version": "0.5.0", | ||
"description": "HubSpot plugin for 'analytics' module", | ||
@@ -54,3 +54,3 @@ "projectMeta": { | ||
}, | ||
"gitHead": "25e62790e3b3b0b45936a7053d146d62b100e7ec" | ||
"gitHead": "09967708f6bbde7b124814b8ea784604450c1247" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
39120
709