gatsby-core-theme 44.4.50 → 44.4.51
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 +7 -0
- package/gatsby-browser.js +21 -16
- package/gatsby-ssr.js +52 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [44.4.51](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v44.4.50...v44.4.51) (2025-09-02)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* testing gtm scripts ([9fc6ffb](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/9fc6ffbcd00472155df82315dffa42a093a0cec7))
|
|
7
|
+
|
|
1
8
|
## [44.4.50](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v44.4.49...v44.4.50) (2025-09-02)
|
|
2
9
|
|
|
3
10
|
|
package/gatsby-browser.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable no-lonely-if */
|
|
1
2
|
/* eslint-disable no-sequences */
|
|
2
3
|
/* eslint-disable one-var */
|
|
3
4
|
/* eslint-disable no-var */
|
|
@@ -121,18 +122,21 @@ const piguard = () =>{
|
|
|
121
122
|
document.head.appendChild(script);
|
|
122
123
|
}
|
|
123
124
|
|
|
124
|
-
function
|
|
125
|
+
function loadThirdPartyScripts() {
|
|
125
126
|
initGTM();
|
|
126
127
|
|
|
127
128
|
if (!document.getElementById('piguard') && process.env.ENABLE_PIGUARD === 'true') {
|
|
128
129
|
piguard();
|
|
129
130
|
}
|
|
130
131
|
|
|
131
|
-
if (process.env.ENABLE_MICROSOFT === 'true' && !document.getElementById('microsoft-code'))
|
|
132
|
+
if (process.env.ENABLE_MICROSOFT === 'true' && !document.getElementById('microsoft-code')) {
|
|
132
133
|
microsoftAdvertising();
|
|
134
|
+
}
|
|
133
135
|
|
|
134
|
-
if (process.env.ENABLE_OPTINMONSTR === 'true' && !document.getElementById('optin-monstr'))
|
|
136
|
+
if (process.env.ENABLE_OPTINMONSTR === 'true' && !document.getElementById('optin-monstr')) {
|
|
135
137
|
optinMonster();
|
|
138
|
+
}
|
|
139
|
+
|
|
136
140
|
if (process.env.ENABLE_PIXEL === 'true' && !document.getElementById('pixel-code')) {
|
|
137
141
|
if (
|
|
138
142
|
typeof window !== 'undefined' &&
|
|
@@ -140,24 +144,25 @@ function scrollEvent(event) {
|
|
|
140
144
|
) {
|
|
141
145
|
loadFacebookPixel();
|
|
142
146
|
|
|
143
|
-
fbq
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
+
// Ensure fbq exists before calling
|
|
148
|
+
if (typeof fbq !== 'undefined') {
|
|
149
|
+
fbq('init', process.env.PIXEL_ID);
|
|
150
|
+
fbq('track', 'PageView');
|
|
151
|
+
}
|
|
147
152
|
}
|
|
148
153
|
}
|
|
149
|
-
|
|
150
|
-
if (event) {
|
|
151
|
-
event.currentTarget.removeEventListener(event.type, scrollEvent); // remove the event listener that got triggered
|
|
152
|
-
}
|
|
153
154
|
}
|
|
154
155
|
|
|
155
156
|
exports.onClientEntry = () => {
|
|
156
157
|
if (process.env.PPC === 'true') {
|
|
157
|
-
|
|
158
|
-
} else {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
158
|
+
loadThirdPartyScripts();
|
|
159
|
+
} else if (typeof window !== 'undefined') {
|
|
160
|
+
const loadScripts = () => loadThirdPartyScripts();
|
|
161
|
+
|
|
162
|
+
if ('requestIdleCallback' in window) {
|
|
163
|
+
requestIdleCallback(loadScripts, { timeout: 3000 });
|
|
164
|
+
} else {
|
|
165
|
+
window.setTimeout(loadScripts, 3000);
|
|
166
|
+
}
|
|
162
167
|
}
|
|
163
168
|
};
|
package/gatsby-ssr.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
/* eslint-disable react/react-in-jsx-scope */
|
|
3
|
+
/* eslint-disable import/prefer-default-export */
|
|
4
|
+
export const onRenderBody = ({ setHeadComponents }) => {
|
|
5
|
+
const links = [];
|
|
6
|
+
|
|
7
|
+
if (process.env.GA_TRACKING_ID) {
|
|
8
|
+
links.push(
|
|
9
|
+
<link
|
|
10
|
+
rel="preconnect"
|
|
11
|
+
href="https://www.googletagmanager.com"
|
|
12
|
+
crossOrigin="anonymous"
|
|
13
|
+
key="gtm-preconnect"
|
|
14
|
+
/>
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (process.env.ENABLE_PIXEL === 'true') {
|
|
19
|
+
links.push(
|
|
20
|
+
<link
|
|
21
|
+
rel="preconnect"
|
|
22
|
+
href="https://connect.facebook.net"
|
|
23
|
+
crossOrigin="anonymous"
|
|
24
|
+
key="fb-preconnect"
|
|
25
|
+
/>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (process.env.ENABLE_OPTINMONSTR === 'true') {
|
|
30
|
+
links.push(
|
|
31
|
+
<link
|
|
32
|
+
rel="preconnect"
|
|
33
|
+
href="https://a.omappapi.com"
|
|
34
|
+
crossOrigin="anonymous"
|
|
35
|
+
key="optin-preconnect"
|
|
36
|
+
/>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (process.env.ENABLE_MICROSOFT === 'true') {
|
|
41
|
+
links.push(
|
|
42
|
+
<link
|
|
43
|
+
rel="preconnect"
|
|
44
|
+
href="https://bat.bing.com"
|
|
45
|
+
crossOrigin="anonymous"
|
|
46
|
+
key="bing-preconnect"
|
|
47
|
+
/>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
setHeadComponents(links);
|
|
52
|
+
};
|