Skip to content
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

Fix(Analytics): Remove GTM #5164

Merged
merged 4 commits into from
Feb 28, 2025
Merged

Fix(Analytics): Remove GTM #5164

merged 4 commits into from
Feb 28, 2025

Conversation

usame-algan
Copy link
Member

What it solves

Resolves #5159

How this PR fixes it

  • Removes TagManager class and moves required logic into the gtm.ts file
  • Adds @next/third-parties package
  • Adds new Analytics component to initialize GA
  • Replaces dataLayer calls with sendGAEvent

ToDos

  • Add env variables to CI

How to test it

  1. Ensure that the same events are still sent to GA
  • Test this PR deployment vs. dev/staging/prod
  • Do the same action in both deployments e.g. Create new transaction
  • Compare collect network call data
  1. Ensure events are still sent to the correct GA property
  • Test property on localhost, dev, staging, PRs
  • Prod property on prod
  • Safe apps property when inside a safe app

Checklist

  • I've tested the branch on mobile 📱
  • I've documented how it affects the analytics (if at all) 📊
  • I've written a unit/e2e test for it (if applicable) 🧑‍💻

Copy link

github-actions bot commented Feb 28, 2025

@usame-algan usame-algan mentioned this pull request Feb 28, 2025
4 tasks
Copy link

github-actions bot commented Feb 28, 2025

📦 Next.js Bundle Analysis for @safe-global/web

This analysis was generated by the Next.js Bundle Analysis action. 🤖

⚠️ Global Bundle Size Increased

Page Size (compressed)
global 1.06 MB (🟡 +73.08 KB)
Details

The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!

Thirty-two Pages Changed Size

The following pages changed size from the code in this PR compared to its base branch:

Page Size (compressed) First Load
/ 509 B (🟢 -1 B) 1.06 MB
/address-book 23.21 KB (🟡 +143 B) 1.08 MB
/apps 31.91 KB (🟢 -1.82 KB) 1.09 MB
/apps/custom 29.97 KB (🟢 -1.82 KB) 1.09 MB
/apps/open 51.51 KB (🟢 -2.1 KB) 1.11 MB
/balances 29.75 KB (🟡 +47 B) 1.09 MB
/balances/nfts 9.32 KB (🟢 -233 B) 1.07 MB
/bridge 2.55 KB (🟢 -6 B) 1.06 MB
/cookie 8.77 KB (🟡 +1 B) 1.07 MB
/home 57.39 KB (🟢 -1.87 KB) 1.12 MB
/licenses 2.46 KB (🟢 -1 B) 1.06 MB
/new-safe/advanced-create 26.38 KB (🟢 -76 B) 1.09 MB
/new-safe/create 25.52 KB (🟢 -68 B) 1.09 MB
/privacy 14.57 KB (🟡 +2 B) 1.07 MB
/settings/appearance 2.25 KB (🟡 +1 B) 1.06 MB
/settings/cookies 1.87 KB (🟡 +1 B) 1.06 MB
/settings/modules 3 KB (🟢 -1.05 KB) 1.06 MB
/settings/notifications 7.52 KB (🟢 -13.8 KB) 1.07 MB
/settings/safe-apps 16.29 KB (🟢 -1.99 KB) 1.08 MB
/settings/security 2.34 KB (🟡 +2 B) 1.06 MB
/settings/setup 30.97 KB (🟡 +246 B) 1.09 MB
/share/safe-app 7.55 KB (🟢 -8 B) 1.07 MB
/stake 618 B (🟢 -1 B) 1.06 MB
/swap 763 B (🟡 +3 B) 1.06 MB
/terms 12.93 KB (🟡 +1 B) 1.07 MB
/transactions 94.71 KB (🟢 -1.87 KB) 1.15 MB
/transactions/history 94.67 KB (🟢 -1.87 KB) 1.15 MB
/transactions/messages 56.4 KB (🟢 -1.9 KB) 1.12 MB
/transactions/msg 52.65 KB (🟢 -1.9 KB) 1.11 MB
/transactions/queue 45.51 KB (🟢 -1.89 KB) 1.1 MB
/transactions/tx 44.87 KB (🟢 -1.9 KB) 1.1 MB
/welcome/accounts 408 B (🟡 +1 B) 1.06 MB
Details

Only the gzipped size is provided here based on an expert tip.

First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

Next to the size is how much the size has increased or decreased compared with the base branch of this PR. If this percentage has increased by 20% or more, there will be a red status indicator applied, indicating that special attention should be given to this.

Copy link

github-actions bot commented Feb 28, 2025

Coverage report for apps/web

St.
Category Percentage Covered / Total
🟡 Statements
77.46% (-0.08% 🔻)
14046/18134
🔴 Branches
57.01% (+0.05% 🔼)
3557/6239
🟡 Functions
62.77% (-0.14% 🔻)
2114/3368
🟡 Lines
78.89% (-0.09% 🔻)
12674/16066
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🟡
... / gtm.ts
61.97% (-8.8% 🔻)
77.78% (+14.14% 🔼)
30.77% (-19.23% 🔻)
67.8% (-9.98% 🔻)
🟡
... / index.tsx
72.73% (-4.55% 🔻)
75% (-25% 🔻)
60%
71.43% (-4.76% 🔻)

Test suite run success

1829 tests passing in 250 suites.

Report generated by 🧪jest coverage report action from 25e1094

@katspaugh katspaugh mentioned this pull request Feb 28, 2025
@katspaugh katspaugh merged commit 71f4f08 into release Feb 28, 2025
6 of 11 checks passed
@katspaugh katspaugh deleted the remove-gtm branch February 28, 2025 10:43
@github-actions github-actions bot locked and limited conversation to collaborators Feb 28, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants