-
Notifications
You must be signed in to change notification settings - Fork 511
fix: route gtm through telemetry entrypoint #8354
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
ede4aa2
c247d7b
563cdbf
2947a99
2db667b
074ec62
bca2c62
a3ccd92
c0ee820
acbaf04
c375b53
f2cf5ab
a43f596
d864e7e
969134e
66cee7d
c439ab1
a4fce64
dd2e18d
921c168
0d2dc2f
8c75f14
894fe54
20a9514
6927c15
22c76c7
3899450
100d0eb
50a2f16
3ec99e8
ea55302
68944ca
233a0c7
294675b
3cd9de4
d898568
2b2043d
320cafd
c29c6fc
c5d170a
dfbbac8
6fa89b8
ea49807
3b1e425
6580b76
65b3089
56df3eb
4d9b015
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| name: 'CI: Dist Telemetry Scan' | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches-ignore: [wip/*, draft/*, temp/*] | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| scan: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | ||
|
|
||
| - name: Install pnpm | ||
| uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0 | ||
| with: | ||
| version: 10 | ||
|
|
||
| - name: Use Node.js | ||
| uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0 | ||
| with: | ||
| node-version: 'lts/*' | ||
| cache: 'pnpm' | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| - name: Install dependencies | ||
| run: pnpm install --frozen-lockfile | ||
|
|
||
| - name: Build project | ||
| run: pnpm build | ||
|
|
||
| - name: Scan dist for telemetry references | ||
| run: | | ||
| set -euo pipefail | ||
| if rg --no-ignore -n \ | ||
| -g '*.html' \ | ||
| -g '*.js' \ | ||
| -e 'Google Tag Manager' \ | ||
| -e '(?i)\bgtm\.js\b' \ | ||
| -e '(?i)googletagmanager\.com/gtm\.js\\?id=' \ | ||
| -e '(?i)googletagmanager\.com/ns\.html\\?id=' \ | ||
| dist; then | ||
| echo 'Telemetry references found in dist assets.' | ||
| exit 1 | ||
| fi | ||
| echo 'No telemetry references found in dist assets.' | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,7 @@ declare const __USE_PROD_CONFIG__: boolean | |
|
|
||
| interface Window { | ||
| __CONFIG__: { | ||
| gtm_container_id?: string | ||
| mixpanel_token?: string | ||
| require_whitelist?: boolean | ||
| subscription_required?: boolean | ||
|
|
@@ -30,6 +31,12 @@ interface Window { | |
| badge?: string | ||
| } | ||
| } | ||
| __ga_identity__?: { | ||
| client_id?: string | ||
| session_id?: string | ||
| session_number?: string | ||
| } | ||
| dataLayer?: Array<Record<string, unknown>> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We’re not trying to assert non‑nullability, I removed the duplicate declare block in GtmTelemetryProvider.ts and kept the single optional type in global.d.ts. The provider initializes window.dataLayer when a GTM ID exists and still guards with ?.push for safety. |
||
| } | ||
|
|
||
| interface Navigator { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.