rudder-sdk-js 1.2.9 → 1.2.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +90 -4
- package/package.json +1 -1
package/index.js
CHANGED
@@ -5469,6 +5469,11 @@
|
|
5469
5469
|
quantumMetric: "QUANTUMMETRIC",
|
5470
5470
|
quantummetric: "QUANTUMMETRIC",
|
5471
5471
|
Quantum_Metric: "QUANTUMMETRIC",
|
5472
|
+
"Google Optimize": "GOOGLE_OPTIMIZE",
|
5473
|
+
GOOGLE_OPTIMIZE: "GOOGLE_OPTIMIZE",
|
5474
|
+
GoogleOptimize: "GOOGLE_OPTIMIZE",
|
5475
|
+
Googleoptimize: "GOOGLE_OPTIMIZE",
|
5476
|
+
GOOGLEOPTIMIZE: "GOOGLE_OPTIMIZE",
|
5472
5477
|
PostAffiliatePro: "POST_AFFILIATE_PRO",
|
5473
5478
|
Post_affiliate_pro: "POST_AFFILIATE_PRO",
|
5474
5479
|
"Post Affiliate Pro": "POST_AFFILIATE_PRO",
|
@@ -5520,6 +5525,7 @@
|
|
5520
5525
|
MP: "Mixpanel",
|
5521
5526
|
QUALTRICS: "Qualtrics",
|
5522
5527
|
SENTRY: "Sentry",
|
5528
|
+
GOOGLE_OPTIMIZE: "GoogleOptimize",
|
5523
5529
|
POST_AFFILIATE_PRO: "PostAffiliatePro"
|
5524
5530
|
};
|
5525
5531
|
|
@@ -5564,7 +5570,7 @@
|
|
5564
5570
|
PRODUCT_REVIEWED: "Product Reviewed"
|
5565
5571
|
}; // Enumeration for integrations supported
|
5566
5572
|
|
5567
|
-
var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.2.
|
5573
|
+
var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.2.10";
|
5568
5574
|
var MAX_WAIT_FOR_INTEGRATION_LOAD = 10000;
|
5569
5575
|
var INTEGRATION_LOAD_CHECK_INTERVAL = 1000;
|
5570
5576
|
/* module.exports = {
|
@@ -22867,12 +22873,14 @@
|
|
22867
22873
|
};
|
22868
22874
|
|
22869
22875
|
/* eslint-disable no-use-before-define */
|
22876
|
+
var defaultAsyncState = true;
|
22870
22877
|
|
22871
22878
|
var ScriptLoader = function ScriptLoader(id, src) {
|
22879
|
+
var async = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultAsyncState;
|
22872
22880
|
logger.debug("in script loader=== ".concat(id));
|
22873
22881
|
var js = document.createElement("script");
|
22874
22882
|
js.src = src;
|
22875
|
-
js.async =
|
22883
|
+
js.async = async === undefined ? defaultAsyncState : async;
|
22876
22884
|
js.type = "text/javascript";
|
22877
22885
|
js.id = id;
|
22878
22886
|
var e = document.getElementsByTagName("script")[0];
|
@@ -33532,6 +33540,10 @@
|
|
33532
33540
|
};
|
33533
33541
|
|
33534
33542
|
this.page = function () {
|
33543
|
+
window._tvq.push([function () {
|
33544
|
+
this.deleteCustomVariable(5, "page");
|
33545
|
+
}]);
|
33546
|
+
|
33535
33547
|
window._tvq.push(["trackPageView"]);
|
33536
33548
|
};
|
33537
33549
|
|
@@ -33627,6 +33639,10 @@
|
|
33627
33639
|
}]);
|
33628
33640
|
|
33629
33641
|
window._tvq.push(["trackPageView"]);
|
33642
|
+
} else {
|
33643
|
+
window._tvq.push([function () {
|
33644
|
+
this.deleteCustomVariable(5, "page");
|
33645
|
+
}]);
|
33630
33646
|
}
|
33631
33647
|
}
|
33632
33648
|
}]);
|
@@ -33794,6 +33810,75 @@
|
|
33794
33810
|
return VWO;
|
33795
33811
|
}();
|
33796
33812
|
|
33813
|
+
var GoogleOptimize = /*#__PURE__*/function () {
|
33814
|
+
function GoogleOptimize(config) {
|
33815
|
+
_classCallCheck(this, GoogleOptimize);
|
33816
|
+
|
33817
|
+
this.name = "GOOGLE_OPTIMIZE";
|
33818
|
+
this.ga = config.ga;
|
33819
|
+
this.trackingId = config.trackingId;
|
33820
|
+
this.containerId = config.containerId;
|
33821
|
+
this.async = config.async;
|
33822
|
+
this.aflicker = config.aflicker;
|
33823
|
+
}
|
33824
|
+
|
33825
|
+
_createClass(GoogleOptimize, [{
|
33826
|
+
key: "init",
|
33827
|
+
value: function init() {
|
33828
|
+
logger.debug("===in init Google Optimize===");
|
33829
|
+
|
33830
|
+
if (!this.containerId) {
|
33831
|
+
return;
|
33832
|
+
} // load optimize script first
|
33833
|
+
|
33834
|
+
|
33835
|
+
ScriptLoader("Google Optimize", "https://www.googleoptimize.com/optimize.js?id=".concat(this.containerId), this.async);
|
33836
|
+
|
33837
|
+
if (this.ga) {
|
33838
|
+
var gtag = function gtag() {
|
33839
|
+
dataLayer.push(arguments);
|
33840
|
+
};
|
33841
|
+
|
33842
|
+
if (!this.trackingId) {
|
33843
|
+
return;
|
33844
|
+
}
|
33845
|
+
|
33846
|
+
ScriptLoader("Google Tag Manager", "https://www.googletagmanager.com/gtag/js?id=".concat(this.trackingId));
|
33847
|
+
window.dataLayer = window.dataLayer || [];
|
33848
|
+
gtag("js", new Date());
|
33849
|
+
gtag("config", "".concat(this.trackingId));
|
33850
|
+
} // anti flicker snippet contains insertBefore since it needs to be executed before any other script
|
33851
|
+
// link -> https://support.google.com/optimize/answer/7100284?hl=en&ref_topic=6197443
|
33852
|
+
|
33853
|
+
|
33854
|
+
if (this.aflicker) {
|
33855
|
+
var flick = document.createElement("style");
|
33856
|
+
flick.innerHTML = ".async-hide { opacity: 0 !important}";
|
33857
|
+
var js = document.createElement("script");
|
33858
|
+
js.innerHTML = "(function(a,s,y,n,c,h,i,d,e){s.className+=' '+y;h.start=1*new Date;h.end=i=function(){s.className=s.className.replace(RegExp(' ?'+y),'')};(a[n]=a[n]||[]).hide=h;setTimeout(function(){i();h.end=null},c);h.timeout=c;})(window,document.documentElement,'async-hide','dataLayer',4000,{'".concat(this.containerId, "':true});");
|
33859
|
+
var e = document.getElementsByTagName("script")[0];
|
33860
|
+
e.parentNode.insertBefore(flick, e); // style tag in anti flicker snippet should be before the a-flicker script as per docs
|
33861
|
+
|
33862
|
+
e.parentNode.insertBefore(js, e);
|
33863
|
+
}
|
33864
|
+
}
|
33865
|
+
}, {
|
33866
|
+
key: "isLoaded",
|
33867
|
+
value: function isLoaded() {
|
33868
|
+
logger.debug("=== in isLoaded Google Optimize===");
|
33869
|
+
return !!window.dataLayer;
|
33870
|
+
}
|
33871
|
+
}, {
|
33872
|
+
key: "isReady",
|
33873
|
+
value: function isReady() {
|
33874
|
+
logger.debug("=== in isReady Google Optimize===");
|
33875
|
+
return !!window.dataLayer;
|
33876
|
+
}
|
33877
|
+
}]);
|
33878
|
+
|
33879
|
+
return GoogleOptimize;
|
33880
|
+
}();
|
33881
|
+
|
33797
33882
|
// This function helps to populate the sale object
|
33798
33883
|
var updateSaleObject = function updateSaleObject(sale, properties) {
|
33799
33884
|
if (properties.total) sale.setTotalCost(properties.total);
|
@@ -33989,6 +34074,7 @@
|
|
33989
34074
|
SNAP_PIXEL: SnapPixel,
|
33990
34075
|
TVSQUARED: TVSquared,
|
33991
34076
|
VWO: VWO,
|
34077
|
+
GOOGLE_OPTIMIZE: GoogleOptimize,
|
33992
34078
|
POST_AFFILIATE_PRO: PostAffiliatePro
|
33993
34079
|
};
|
33994
34080
|
|
@@ -33999,7 +34085,7 @@
|
|
33999
34085
|
this.build = "1.0.0";
|
34000
34086
|
this.name = "RudderLabs JavaScript SDK";
|
34001
34087
|
this.namespace = "com.rudderlabs.javascript";
|
34002
|
-
this.version = "1.2.
|
34088
|
+
this.version = "1.2.10";
|
34003
34089
|
};
|
34004
34090
|
|
34005
34091
|
// Library information class
|
@@ -34007,7 +34093,7 @@
|
|
34007
34093
|
_classCallCheck(this, RudderLibraryInfo);
|
34008
34094
|
|
34009
34095
|
this.name = "RudderLabs JavaScript SDK";
|
34010
|
-
this.version = "1.2.
|
34096
|
+
this.version = "1.2.10";
|
34011
34097
|
}; // Operating System information class
|
34012
34098
|
|
34013
34099
|
|