gatsby-plugin-rudderstack 4.0.0 → 4.0.1
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/CHANGELOG.md +6 -11
- package/gatsby-ssr.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,25 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
-
## [4.0.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
### Features
|
|
5
|
+
## [4.0.1](https://github.com/rudderlabs/gatsby-plugin-rudderstack/compare/v4.0.0...v4.0.1) (2024-03-29)
|
|
9
6
|
|
|
10
|
-
|
|
11
|
-
* use JS SDK v3 loading snippet with new useLegacySDK option for v2.x usage ([#26](https://github.com/rudderlabs/gatsby-plugin-rudderstack/issues/26)) ([c05cdbb](https://github.com/rudderlabs/gatsby-plugin-rudderstack/commit/c05cdbb15ef5fb6862d7d9804e980219d7ab6fe3))
|
|
7
|
+
### Bug Fixes
|
|
12
8
|
|
|
13
|
-
|
|
9
|
+
* fix: loading snippet ([766f805]https://github.com/rudderlabs/gatsby-plugin-rudderstack/commit/766f8056cf1cc064207bf6caa2108928999d90b9)
|
|
14
10
|
|
|
15
11
|
|
|
16
|
-
|
|
12
|
+
## [4.0.0](https://github.com/rudderlabs/gatsby-plugin-rudderstack/compare/v3.0.0...v4.0.0) (2024-03-28)
|
|
17
13
|
|
|
18
|
-
* modify delayLoad functionality (#17)
|
|
19
14
|
|
|
20
15
|
### Features
|
|
21
16
|
|
|
22
|
-
*
|
|
23
|
-
*
|
|
17
|
+
* use js sdk v3 ([#30](https://github.com/rudderlabs/gatsby-plugin-rudderstack/issues/30)) ([3c81fd7](https://github.com/rudderlabs/gatsby-plugin-rudderstack/commit/3c81fd7eefefdf3afe1f8a28fd5a5eff7b6009c6))
|
|
18
|
+
* use JS SDK v3 loading snippet with new useLegacySDK option for v2.x usage ([#26](https://github.com/rudderlabs/gatsby-plugin-rudderstack/issues/26)) ([c05cdbb](https://github.com/rudderlabs/gatsby-plugin-rudderstack/commit/c05cdbb15ef5fb6862d7d9804e980219d7ab6fe3))
|
|
24
19
|
|
|
25
20
|
## [3.0.0](https://github.com/rudderlabs/gatsby-plugin-rudderstack/compare/v2.0.0...v3.0.0) (2023-12-05)
|
|
26
21
|
|
package/gatsby-ssr.js
CHANGED
|
@@ -29,7 +29,7 @@ exports.onRenderBody = function (_ref, pluginOptions) {
|
|
|
29
29
|
configUrl: controlPlaneUrl || loadOptions.configUrl
|
|
30
30
|
});
|
|
31
31
|
var loadConfig = "'".concat(writeKey, "', '").concat(dataPlaneUrl, "', ").concat(JSON.stringify(finalLoadOptions));
|
|
32
|
-
var snippet = "!function(){\"use strict\";window.RudderSnippetVersion=\"3.0.3\";var sdkBaseUrl
|
|
32
|
+
var snippet = "!function(){\"use strict\";window.RudderSnippetVersion=\"3.0.3\";var sdkBaseUrl=\"".concat(sdkURL, "\";var sdkName=\"rsa.min.js\";var asyncScript=").concat(loadType === 'async', ";var deferScript=").concat(loadType === 'defer', ";window.rudderAnalyticsBuildType=\"legacy\",window.rudderanalytics=[]\n ;var e=[\"setDefaultInstanceKey\",\"load\",\"ready\",\"page\",\"track\",\"identify\",\"alias\",\"group\",\"reset\",\"setAnonymousId\",\"startSession\",\"endSession\",\"consent\"]\n ;for(var n=0;n<e.length;n++){var t=e[n];window.rudderanalytics[t]=function(e){return function(){\n window.rudderanalytics.push([e].concat(Array.prototype.slice.call(arguments)))}}(t)}try{\n new Function('return import(\"\")'),window.rudderAnalyticsBuildType=\"modern\"}catch(a){}\n if(window.rudderAnalyticsMount=function(){\n \"undefined\"==typeof globalThis&&(Object.defineProperty(Object.prototype,\"__globalThis_magic__\",{get:function get(){\n return this},configurable:true}),__globalThis_magic__.globalThis=__globalThis_magic__,\n delete Object.prototype.__globalThis_magic__);var e=document.createElement(\"script\")\n ;e.src=\"\".concat(sdkBaseUrl,\"/\").concat(window.rudderAnalyticsBuildType,\"/\").concat(sdkName),asyncScript&&(e.async=true),deferScript&&(e.defer=true),document.head?document.head.appendChild(e):document.body.appendChild(e)\n },\"undefined\"==typeof Promise||\"undefined\"==typeof globalThis){var d=document.createElement(\"script\")\n ;d.src=\"https://polyfill-fastly.io/v3/polyfill.min.js?version=3.111.0&features=Symbol%2CPromise&callback=rudderAnalyticsMount\",\n d.async=asyncScript,document.head?document.head.appendChild(d):document.body.appendChild(d)}else{\n window.rudderAnalyticsMount()}}();");
|
|
33
33
|
var instantLoader = "".concat(snippet).concat(manualLoad ? "" : "window.rudderanalytics.load(".concat(loadConfig, ")"), ";");
|
|
34
34
|
var delayedLoader = "\n window.rudderSnippetLoaded = false;\n window.rudderSnippetLoading = false;\n window.rudderSnippetLoadedCallback = undefined;\n window.rudderSnippetLoader = function (callback) {\n if (!window.rudderSnippetLoaded && !window.rudderSnippetLoading) {\n window.rudderSnippetLoading = true;\n function loader() {\n ".concat(snippet, "\n window.rudderanalytics.load(").concat(loadConfig, ");\n window.rudderSnippetLoading = false;\n window.rudderSnippetLoaded = true;\n if (callback) { callback(); }\n if (window.rudderSnippetLoadedCallback) {\n window.rudderSnippetLoadedCallback();\n window.rudderSnippetLoadedCallback = undefined;\n }\n };\n\n \"requestIdleCallback\" in window\n ? requestIdleCallback(function () { loader(); })\n : loader();\n }\n }\n window.addEventListener('scroll',function () {window.rudderSnippetLoader()}, { once: true });\n setTimeout(\n function () {\n \"requestIdleCallback\" in window\n ? requestIdleCallback(function () { window.rudderSnippetLoader(); })\n : window.rudderSnippetLoader();\n },\n ").concat(delayLoadTime, " || 1000\n );\n ");
|
|
35
35
|
var snippetToUse = "".concat(delayLoad && !manualLoad ? delayedLoader : instantLoader);
|