Skip to content

Commit 9e2e86f

Browse files
committed
Integrate Pinterest Tag
1 parent 4d8beba commit 9e2e86f

File tree

3 files changed

+33
-9
lines changed

3 files changed

+33
-9
lines changed

docusaurus.config.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,10 @@ const config: Config = {
2727
async: true,
2828
},
2929
{
30-
content: `
31-
window.dataLayer = window.dataLayer || [];
32-
function gtag(){dataLayer.push(arguments);}
33-
gtag('js', new Date());
34-
gtag('config', 'G-W02Z2VJYCR', {
35-
debug_mode: ${process.env.NODE_ENV !== 'production' ? 'true' : 'false'}
36-
});
37-
`,
30+
src: '/gtag-init.js',
31+
},
32+
{
33+
src: '/pinterest-init.js',
3834
},
3935
],
4036

@@ -289,7 +285,7 @@ const config: Config = {
289285
},
290286
],
291287
],
292-
scripts: [],
288+
// scripts: [],
293289
};
294290

295291
export default config;

static/gtag-init.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
console.log('✅ gtag-init.js loaded');
2+
3+
window.dataLayer = window.dataLayer || [];
4+
function gtag() { dataLayer.push(arguments); }
5+
gtag('js', new Date());
6+
gtag('config', 'G-W02ZZ2VJYCR', {
7+
debug_mode: location.hostname === 'localhost' ? 'true' : 'false'
8+
});

static/pinterest-init.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
console.log('✅ pinterest-init.js loaded');
2+
!function(e){
3+
if (!window.pintrk) {
4+
window.pintrk = function () {
5+
window.pintrk.queue.push(Array.prototype.slice.call(arguments));
6+
};
7+
var n = window.pintrk;
8+
n.queue = [], n.version = "3.0";
9+
var t = document.createElement("script");
10+
t.async = !0;
11+
t.src = e;
12+
var r = document.getElementsByTagName("script")[0];
13+
r.parentNode.insertBefore(t, r);
14+
}
15+
}("https://s.pinimg.com/ct/core.js");
16+
17+
pintrk('load', '2613717138491', {
18+
em: 'b58906c504c5638798eb06151e6f49af1b0e4c6c3b5d4f30d9c2268dbe6f9d60' // example hashed email
19+
});
20+
pintrk('page');

0 commit comments

Comments
 (0)