@gem-sdk/pages 1.12.0-staging-2b439c82 → 1.12.0-staging-101c3f37
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/dist/cjs/components/FacebookPixel.js +2 -3
- package/dist/cjs/components/GoogleAnalytic.js +10 -6
- package/dist/cjs/components/TikTokPixel.js +1 -1
- package/dist/esm/components/FacebookPixel.js +2 -3
- package/dist/esm/components/GoogleAnalytic.js +10 -6
- package/dist/esm/components/TikTokPixel.js +1 -1
- package/package.json +1 -1
|
@@ -9,8 +9,6 @@ var react = require('react');
|
|
|
9
9
|
const FacebookPixel = ({ pixelId })=>{
|
|
10
10
|
const router$1 = router.useRouter();
|
|
11
11
|
react.useEffect(()=>{
|
|
12
|
-
// This pageview only triggers the first time (it's important for Pixel to have real information)
|
|
13
|
-
core.fpixel.pageview();
|
|
14
12
|
const handleRouteChange = ()=>{
|
|
15
13
|
core.fpixel.pageview();
|
|
16
14
|
};
|
|
@@ -26,7 +24,7 @@ const FacebookPixel = ({ pixelId })=>{
|
|
|
26
24
|
if (!pixelId) return null;
|
|
27
25
|
return /*#__PURE__*/ jsxRuntime.jsx(Script, {
|
|
28
26
|
id: "fb-pixel",
|
|
29
|
-
strategy: "
|
|
27
|
+
strategy: "lazyOnload",
|
|
30
28
|
dangerouslySetInnerHTML: {
|
|
31
29
|
__html: `
|
|
32
30
|
!function(f,b,e,v,n,t,s)
|
|
@@ -38,6 +36,7 @@ const FacebookPixel = ({ pixelId })=>{
|
|
|
38
36
|
s.parentNode.insertBefore(t,s)}(window, document,'script',
|
|
39
37
|
'https://connect.facebook.net/en_US/fbevents.js');
|
|
40
38
|
fbq('init', ${pixelId});
|
|
39
|
+
fbq('track', 'PageView');
|
|
41
40
|
`
|
|
42
41
|
}
|
|
43
42
|
});
|
|
@@ -22,17 +22,20 @@ const GoogleAnalytic = ({ trackingId })=>{
|
|
|
22
22
|
trackingId,
|
|
23
23
|
router$1.events
|
|
24
24
|
]);
|
|
25
|
+
const handleOnReady = ()=>{
|
|
26
|
+
core.gtag.pageview(router$1.pathname, trackingId);
|
|
27
|
+
};
|
|
25
28
|
if (!trackingId) return null;
|
|
26
29
|
if (trackingId.startsWith('UA-')) return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
27
30
|
children: [
|
|
28
31
|
/*#__PURE__*/ jsxRuntime.jsx(Script, {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
strategy: "lazyOnload",
|
|
33
|
+
onReady: handleOnReady,
|
|
34
|
+
src: "https://www.google-analytics.com/analytics.js"
|
|
32
35
|
}),
|
|
33
36
|
/*#__PURE__*/ jsxRuntime.jsx(Script, {
|
|
34
|
-
strategy: "afterInteractive",
|
|
35
37
|
id: "google-analytics",
|
|
38
|
+
strategy: "lazyOnload",
|
|
36
39
|
dangerouslySetInnerHTML: {
|
|
37
40
|
__html: `window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
|
|
38
41
|
ga('create', '${trackingId}', 'auto');
|
|
@@ -46,12 +49,13 @@ const GoogleAnalytic = ({ trackingId })=>{
|
|
|
46
49
|
return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
47
50
|
children: [
|
|
48
51
|
/*#__PURE__*/ jsxRuntime.jsx(Script, {
|
|
49
|
-
strategy: "
|
|
52
|
+
strategy: "lazyOnload",
|
|
53
|
+
onReady: handleOnReady,
|
|
50
54
|
src: `https://www.googletagmanager.com/gtag/js?id=${trackingId}`
|
|
51
55
|
}),
|
|
52
56
|
/*#__PURE__*/ jsxRuntime.jsx(Script, {
|
|
53
57
|
id: "gtag-init",
|
|
54
|
-
strategy: "
|
|
58
|
+
strategy: "lazyOnload",
|
|
55
59
|
dangerouslySetInnerHTML: {
|
|
56
60
|
__html: `
|
|
57
61
|
window.dataLayer = window.dataLayer || [];
|
|
@@ -7,8 +7,6 @@ import { useEffect } from 'react';
|
|
|
7
7
|
const FacebookPixel = ({ pixelId })=>{
|
|
8
8
|
const router = useRouter();
|
|
9
9
|
useEffect(()=>{
|
|
10
|
-
// This pageview only triggers the first time (it's important for Pixel to have real information)
|
|
11
|
-
fpixel.pageview();
|
|
12
10
|
const handleRouteChange = ()=>{
|
|
13
11
|
fpixel.pageview();
|
|
14
12
|
};
|
|
@@ -24,7 +22,7 @@ const FacebookPixel = ({ pixelId })=>{
|
|
|
24
22
|
if (!pixelId) return null;
|
|
25
23
|
return /*#__PURE__*/ jsx(Script, {
|
|
26
24
|
id: "fb-pixel",
|
|
27
|
-
strategy: "
|
|
25
|
+
strategy: "lazyOnload",
|
|
28
26
|
dangerouslySetInnerHTML: {
|
|
29
27
|
__html: `
|
|
30
28
|
!function(f,b,e,v,n,t,s)
|
|
@@ -36,6 +34,7 @@ const FacebookPixel = ({ pixelId })=>{
|
|
|
36
34
|
s.parentNode.insertBefore(t,s)}(window, document,'script',
|
|
37
35
|
'https://connect.facebook.net/en_US/fbevents.js');
|
|
38
36
|
fbq('init', ${pixelId});
|
|
37
|
+
fbq('track', 'PageView');
|
|
39
38
|
`
|
|
40
39
|
}
|
|
41
40
|
});
|
|
@@ -20,17 +20,20 @@ const GoogleAnalytic = ({ trackingId })=>{
|
|
|
20
20
|
trackingId,
|
|
21
21
|
router.events
|
|
22
22
|
]);
|
|
23
|
+
const handleOnReady = ()=>{
|
|
24
|
+
gtag.pageview(router.pathname, trackingId);
|
|
25
|
+
};
|
|
23
26
|
if (!trackingId) return null;
|
|
24
27
|
if (trackingId.startsWith('UA-')) return /*#__PURE__*/ jsxs(Fragment, {
|
|
25
28
|
children: [
|
|
26
29
|
/*#__PURE__*/ jsx(Script, {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
+
strategy: "lazyOnload",
|
|
31
|
+
onReady: handleOnReady,
|
|
32
|
+
src: "https://www.google-analytics.com/analytics.js"
|
|
30
33
|
}),
|
|
31
34
|
/*#__PURE__*/ jsx(Script, {
|
|
32
|
-
strategy: "afterInteractive",
|
|
33
35
|
id: "google-analytics",
|
|
36
|
+
strategy: "lazyOnload",
|
|
34
37
|
dangerouslySetInnerHTML: {
|
|
35
38
|
__html: `window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
|
|
36
39
|
ga('create', '${trackingId}', 'auto');
|
|
@@ -44,12 +47,13 @@ const GoogleAnalytic = ({ trackingId })=>{
|
|
|
44
47
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
45
48
|
children: [
|
|
46
49
|
/*#__PURE__*/ jsx(Script, {
|
|
47
|
-
strategy: "
|
|
50
|
+
strategy: "lazyOnload",
|
|
51
|
+
onReady: handleOnReady,
|
|
48
52
|
src: `https://www.googletagmanager.com/gtag/js?id=${trackingId}`
|
|
49
53
|
}),
|
|
50
54
|
/*#__PURE__*/ jsx(Script, {
|
|
51
55
|
id: "gtag-init",
|
|
52
|
-
strategy: "
|
|
56
|
+
strategy: "lazyOnload",
|
|
53
57
|
dangerouslySetInnerHTML: {
|
|
54
58
|
__html: `
|
|
55
59
|
window.dataLayer = window.dataLayer || [];
|