Skip to content

feat: migrate google-analytics-4 kit to monorepo#1206

Open
nickolas-dimitrakas wants to merge 6 commits intoworkstation/3.0-Releasefrom
feat/migrate-ga4
Open

feat: migrate google-analytics-4 kit to monorepo#1206
nickolas-dimitrakas wants to merge 6 commits intoworkstation/3.0-Releasefrom
feat/migrate-ga4

Conversation

@nickolas-dimitrakas
Copy link
Contributor

Background

  • The web SDK is adopting the kits-in-monorepo pattern as part of the kit simplification initiative. Kits are moving from individual `mparticle-integrations` repos into the `mparticle-web-sdk` monorepo under `kits/`.
  • The GA4 integration has both a client-side and server-side package. After this PR is merged, a corresponding backend PR will be required to reflect the new package locations.

What Changed

  • Migrated `GA4Client` from `mparticle-javascript-integration-google-analytics-4` into `kits/google-analytics-4/ga4-client/`
  • Migrated `GA4Server` from `mparticle-javascript-integration-google-analytics-4` into `kits/google-analytics-4/ga4-server/`
  • Updated `kits/matrix.json` so CI automatically picks up and tests both kits on every PR
  • Updated `package.json` repository fields to point to the monorepo
  • Applied Prettier formatting to match monorepo code style conventions

Checklist

  • I have performed a self-review of my own code.
  • I have made corresponding changes to the documentation.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have tested this locally.

Reference Issue (For employees only. Ignore if you are an outside contributor)

nickolas-dimitrakas and others added 4 commits March 9, 2026 12:41
Migrates GA4Client and GA4Server packages from
mparticle-javascript-integration-google-analytics-4 into the web SDK
monorepo under kits/google-analytics-4/.

- kits/google-analytics-4/ga4-client (@mparticle/web-google-analytics-4-client-kit v1.5.1)
- kits/google-analytics-4/ga4-server (@mparticle/web-google-analytics-4-server-kit v1.0.3)
- Updated package.json repository fields to point to monorepo
- Added both kits to kits/matrix.json for CI coverage
- Applied Prettier formatting to match monorepo code style conventions

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The test script calls karma but karma was missing from devDependencies.
Add karma and browser launcher packages to match the ga4-client kit.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Updating package-lock.json to include karma and browser launcher
packages added in the previous commit.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
karma-chai@0.1.0 requires chai v4's browser bundle at chai/chai.js.
chai v6 changed its file structure, breaking that path. Pinning
chai to ^4.2.0 restores the expected bundle location.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
nickolas-dimitrakas and others added 2 commits March 9, 2026 15:09
The original mparticle-javascript-integration-google-analytics-4 repo
used a packages/GA4Client + packages/GA4Server layout with a root
package.json orchestrator. The migration commit incorrectly flattened
this to ga4-client/ and ga4-server/ at the top level and omitted the
root package.json.

This commit:
- Moves ga4-client/ → packages/GA4Client/ (git mv, history preserved)
- Moves ga4-server/ → packages/GA4Server/ (git mv, history preserved)
- Updates repository.directory in each sub-kit's package.json
- Adds root package.json with build/test scripts that delegate to each
  sub-package via npm --prefix
- Adds root package-lock.json (no root deps; required for npm ci)
- Collapses the two matrix entries into a single "Google Analytics 4"
  entry pointing to kits/google-analytics-4

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Restores the root-level config files that existed in the original
mparticle-integrations/mparticle-javascript-integration-google-analytics-4
repo but were not included in the monorepo migration:

- .eslintrc  — eslint + prettier config (root: true)
- .gitignore — ignores node_modules
- .prettierrc — singleQuote, trailingComma: es5, tabWidth: 4
- README.md  — usage docs for both client and server kits

Also updates package.json description to match the original.
The .github/workflows/ are omitted as the monorepo has its own CI.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 9, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot
6.4% Duplication on New Code (required ≤ 3%)
D Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant