Skip to content

Commit 7fc7bd3

Browse files
oswishBrian Swisher
andauthored
[MKTG-1081][c] vanilla pixel pattern - implement CDP (Segment), Influ2, & GrowthChannel (#107) (#108)
Co-authored-by: Brian Swisher <brian.swisher@postman.com@Brians-MacBook-Pro.local>
1 parent 83dfce4 commit 7fc7bd3

File tree

9 files changed

+20100
-10405
lines changed

9 files changed

+20100
-10405
lines changed

.github/workflows/beta-deploy.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- name: Setup Node
2525
uses: actions/setup-node@master
2626
with:
27-
node-version: '14'
27+
node-version: '18.20.5'
2828

2929
- name: Configure AWS Credentials
3030
uses: aws-actions/configure-aws-credentials@v1
@@ -57,7 +57,7 @@ jobs:
5757
DOMAIN_NAME: ${{secrets.BETA_DOMAIN_NAME}}
5858
run: |
5959
npm config set //registry.npmjs.org/:_authToken=${{secrets.NPM_TOKEN}}
60-
npm install
60+
npm run npm
6161
npm run clean
6262
npm run build:dev
6363
aws s3 sync ./public/ s3://${{secrets.BETA_BUCKET_NAME}}/${{ steps.sanitized-branch.outputs.SANITIZED_BRANCH}}/collection-format --delete

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ jobs:
1414
- uses: actions/checkout@v1
1515
- uses: actions/setup-node@master
1616
with:
17-
node-version: '14'
17+
node-version: '18.20.5'
1818
- name: lint all markdownfiles
1919
env:
2020
PM_TECH_RT: ${{secrets.PM_TECH_RT}}
2121
run: |
2222
npm config set //registry.npmjs.org/:_authToken=${{secrets.NPM_TOKEN}}
23-
npm install
23+
npm run npm
2424
node_modules/.bin/markdownlint ./ --ignore node_modules --fix
2525
- name: check for image url
2626
run: |
@@ -34,7 +34,7 @@ jobs:
3434
PM_TECH_RT: ${{secrets.PM_TECH_RT}}
3535
run: |
3636
npm config set //registry.npmjs.org/:_authToken=${{secrets.NPM_TOKEN}}
37-
npm install
37+
npm run npm
3838
npm run clean
3939
npm run test:update
4040

.github/workflows/manual-rerun.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ jobs:
1010
- uses: actions/checkout@v1
1111
- uses: actions/setup-node@master
1212
with:
13-
node-version: '14'
13+
node-version: '18.20.5'
1414
- name: lint all markdownfiles
1515
env:
1616
PM_TECH_RT: ${{secrets.PM_TECH_RT}}
1717
run: |
1818
npm config set //registry.npmjs.org/:_authToken=${{secrets.NPM_TOKEN}}
19-
npm install
19+
npm run npm
2020
node_modules/.bin/markdownlint ./ --ignore node_modules
2121
- name: check for image url
2222
run: |
@@ -30,6 +30,6 @@ jobs:
3030
PM_TECH_RT: ${{secrets.PM_TECH_RT}}
3131
run: |
3232
npm config set //registry.npmjs.org/:_authToken=${{secrets.NPM_TOKEN}}
33-
npm install
33+
npm run npm
3434
npm run clean
3535
npm run test:update

.github/workflows/prod-deploy.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- name: Setup Node
2222
uses: actions/setup-node@master
2323
with:
24-
node-version: '14'
24+
node-version: '18.20.5'
2525

2626
- name: Configure AWS Credentials
2727
uses: aws-actions/configure-aws-credentials@v1
@@ -49,7 +49,7 @@ jobs:
4949
DOMAIN_NAME: ${{secrets.PROD_DOMAIN_NAME}}
5050
run: |
5151
npm config set //registry.npmjs.org/:_authToken=${{secrets.NPM_TOKEN}}
52-
npm install
52+
npm run npm
5353
npm run clean
5454
npm run build:prod
5555
aws s3 sync ./public/ s3://${{secrets.PROD_BUCKET_NAME}}/main/collection-format --delete

bff.js

Lines changed: 23 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@ const pingWebHook = require('./build/pingWebHook');
55
const fetchBlogPosts = require('./build/fetchBlogPosts');
66
const fetchFooter = require('./build/fetchFooter');
77
const fetchNavbar = require('./build/fetchNavbar');
8-
const { allow } = require('./package.json');
98
const fetchNavtopicsdropdown = require('./build/fetchNavtopicsdropdown');
109

11-
const { pmTech: allowedPmTech } = allow;
1210
const delay = 1000;
1311
const runtime = {
1412
pm: [''],
@@ -46,11 +44,11 @@ const prefetch = async () => {
4644
fetchNavbar();
4745
fetchNavtopicsdropdown();
4846

49-
let pmTech = '';
47+
let runtimeScript = '';
5048

5149
if (process.env.PM_TECH_RT) {
5250
sh.config.silent = true;
53-
pmTech = sh.exec('cat build/pmt.js').stdout;
51+
runtimeScript = sh.exec('cat build/runtime.js').stdout;
5452
sh.config.silent = false;
5553

5654
sh.exec('mkdir -p public');
@@ -88,40 +86,28 @@ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
8886

8987
const script = (process.env.PM_TECH_RT
9088
&& `
91-
${pmTech}
89+
${runtimeScript}
9290
setTimeout(function(){
93-
var propertyName = 'collection-format-docs';
94-
if (window.pmt) {
95-
window.pmt('setScalp', [{
96-
property: propertyName
97-
}]);
98-
window.pmt('scalp', [
99-
'pm-analytics',
100-
'load',
101-
document.location.pathname
102-
]);
103-
window.pmt('trackClicks');
104-
var dnt = (parseInt(navigator.doNotTrack) === 1 || parseInt(window.doNotTrack) === 1 || parseInt(navigator.msDoNotTrack) === 1 || navigator.doNotTrack === "yes");
105-
window.pmt('log', ['navigator.doNotTrack: ' + dnt]);
106-
if(!dnt) {
107-
${googleTagManager}
108-
window.pmt('log', ['attached googletagmanager: ' + '${GTMCode}']);
109-
var d = 1000, int;
110-
var int = setInterval(function(){
111-
if (window.ga) {
112-
var sitename = document.location.hostname;
113-
window.dataLayer = window.dataLayer || [];
114-
function gtag(){dataLayer.push(arguments);}
115-
window.gtag = gtag;
116-
gtag('js', new Date());
117-
gtag('config', '${UACode}');
118-
window.pmt('ga', ['${UACode}', sitename]);
119-
window.pmt('log', ['initialized GA: ' + sitename + ' (' + '${UACode}' + ')']);
120-
window._iaq = window._iaq || {};
121-
clearInterval(int);
122-
}
123-
}, d);
124-
}
91+
var dnt = (parseInt(navigator.doNotTrack) === 1 || parseInt(window.doNotTrack) === 1 || parseInt(navigator.msDoNotTrack) === 1 || navigator.doNotTrack === "yes");
92+
window.pmt('log', ['navigator.doNotTrack: ' + dnt]);
93+
if(!dnt) {
94+
${googleTagManager}
95+
window.pmt('log', ['attached googletagmanager: ' + '${GTMCode}']);
96+
var d = 1000, int;
97+
var int = setInterval(function(){
98+
if (window.ga) {
99+
var sitename = document.location.hostname;
100+
window.dataLayer = window.dataLayer || [];
101+
function gtag(){dataLayer.push(arguments);}
102+
window.gtag = gtag;
103+
gtag('js', new Date());
104+
gtag('config', '${UACode}');
105+
window.pmt('ga', ['${UACode}', sitename]);
106+
window.pmt('log', ['initialized GA: ' + sitename + ' (' + '${UACode}' + ')']);
107+
window._iaq = window._iaq || {};
108+
clearInterval(int);
109+
}
110+
}, d);
125111
}
126112
}, 1000);
127113
`)

build/pmt.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

build/runtime.js

Lines changed: 183 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)