Skip to content

feat: support custom sdkBaseUrl in google ads sdk#3002

Merged
maheshkutty merged 6 commits into
developfrom
harness/eb5a3f20-ea69-42b1-a0cb-84c65847c67b-feat-support-custom-sdkbaseurl-in-g-sx5d
May 22, 2026
Merged

feat: support custom sdkBaseUrl in google ads sdk#3002
maheshkutty merged 6 commits into
developfrom
harness/eb5a3f20-ea69-42b1-a0cb-84c65847c67b-feat-support-custom-sdkbaseurl-in-g-sx5d

Conversation

@rudder-devbox

@rudder-devbox rudder-devbox Bot commented May 11, 2026

Copy link
Copy Markdown
Contributor

PR Description

Added support for loading Google Ads gtag.js from an optional custom base URL in JS web device mode. The integration now reads config.sdkBaseUrl, normalizes trailing slashes, falls back to https://www.googletagmanager.com when unset, and uses that base during SDK script load.

Also added tests to verify:

  • default GTM domain is used when sdkBaseUrl is absent
  • custom domain is used when sdkBaseUrl is provided
  • trailing slashes are normalized before constructing the script URL

Linear task (optional)

Resolves INT-6255

Cross Browser Tests

Please confirm you have tested for the following browsers:

  • Chrome
  • Firefox
  • IE11

Sanity Suite

  • All sanity suite test cases pass locally

Security

  • The code changed/added as part of this pull request won't create any security issues with how the software is being used.

Copilot AI review requested due to automatic review settings May 11, 2026 16:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@github-actions

github-actions Bot commented May 11, 2026

Copy link
Copy Markdown

size-limit report 📦

Name Size Delta Limit check
Common - No bundling 5.78 KB 0 B (0% 🟢) 6 KB (✅)
Legacy Utils - No bundling 11.11 KB 0 B (0% 🟢) 12 KB (✅)
Cookies Utils - Legacy - NPM (ESM) 1.54 KB 0 B (0% 🟢) 2 KB (✅)
Cookies Utils - Legacy - NPM (CJS) 1.74 KB 0 B (0% 🟢) 2 KB (✅)
Cookies Utils - Legacy - NPM (UMD) 1.52 KB 0 B (0% 🟢) 2 KB (✅)
Cookies Utils - Modern - NPM (ESM) 1.16 KB 0 B (0% 🟢) 1.5 KB (✅)
Cookies Utils - Modern - NPM (CJS) 1.39 KB 0 B (0% 🟢) 1.5 KB (✅)
Cookies Utils - Modern - NPM (UMD) 1.15 KB 0 B (0% 🟢) 1.5 KB (✅)
Plugins Module Federation Mapping - Legacy - CDN 330 B 0 B (0% 🟢) 512 B (✅)
Plugins Module Federation Mapping - Modern - CDN 330 B 0 B (0% 🟢) 512 B (✅)
Plugins - Legacy - CDN 13.6 KB 0 B (0% 🟢) 15 KB (✅)
Plugins - Modern - CDN 5.52 KB 0 B (0% 🟢) 6 KB (✅)
Core (v1.1) - NPM (ESM) 29.74 KB 0 B (0% 🟢) 32 KB (✅)
Core (v1.1) - NPM (CJS) 29.97 KB 0 B (0% 🟢) 32 KB (✅)
Core (v1.1) - NPM (UMD) 29.77 KB 0 B (0% 🟢) 32 KB (✅)
Core (Content Script - v1.1) - NPM (ESM) 29.33 KB 0 B (0% 🟢) 30.5 KB (✅)
Core (Content Script - v1.1) - NPM (CJS) 29.55 KB 0 B (0% 🟢) 30.5 KB (✅)
Core (Content Script - v1.1) - NPM (UMD) 29.34 KB 0 B (0% 🟢) 30.5 KB (✅)
Core (v1.1) - Legacy - CDN 31.27 KB 0 B (0% 🟢) 32.5 KB (✅)
Core (v1.1) - Modern - CDN 29.69 KB 0 B (0% 🟢) 32 KB (✅)
Service Worker - Legacy - NPM (ESM) 31.55 KB 0 B (0% 🟢) 32 KB (✅)
Service Worker - Legacy - NPM (CJS) 31.77 KB 0 B (0% 🟢) 32 KB (✅)
Service Worker - Legacy - NPM (UMD) 31.6 KB 0 B (0% 🟢) 32 KB (✅)
Service Worker - Modern - NPM (ESM) 27.46 KB 0 B (0% 🟢) 28 KB (✅)
Service Worker - Modern - NPM (CJS) 27.66 KB 0 B (0% 🟢) 28 KB (✅)
Service Worker - Modern - NPM (UMD) 27.46 KB 0 B (0% 🟢) 28 KB (✅)
All Integrations - Legacy - CDN 95.83 KB 181 B (+0.19% 🔺) 97 KB (✅)
All Integrations - Modern - CDN 88.3 KB 108 B (+0.12% 🔺) 93.5 KB (✅)
Core - Legacy - NPM (ESM) 47.8 KB 0 B (0% 🟢) 50 KB (✅)
Core - Legacy - NPM (CJS) 47.93 KB 0 B (0% 🟢) 50 KB (✅)
Core - Legacy - NPM (UMD) 47.75 KB 0 B (0% 🟢) 50 KB (✅)
Core - Legacy - CDN 47.92 KB 0 B (0% 🟢) 50 KB (✅)
Core - Modern - NPM (ESM) 27.08 KB 0 B (0% 🟢) 28.5 KB (✅)
Core - Modern - NPM (CJS) 27.31 KB 0 B (0% 🟢) 28.5 KB (✅)
Core - Modern - NPM (UMD) 27.12 KB 0 B (0% 🟢) 28.5 KB (✅)
Core - Modern - CDN 27.35 KB 0 B (0% 🟢) 28.5 KB (✅)
Core (Bundled) - Legacy - NPM (ESM) 47.77 KB 0 B (0% 🟢) 50 KB (✅)
Core (Bundled) - Legacy - NPM (CJS) 47.95 KB 0 B (0% 🟢) 50 KB (✅)
Core (Bundled) - Legacy - NPM (UMD) 47.81 KB 0 B (0% 🟢) 50 KB (✅)
Core (Bundled) - Modern - NPM (ESM) 40.32 KB 0 B (0% 🟢) 41.5 KB (✅)
Core (Bundled) - Modern - NPM (CJS) 40.53 KB 0 B (0% 🟢) 42 KB (✅)
Core (Bundled) - Modern - NPM (UMD) 40.38 KB 0 B (0% 🟢) 41.5 KB (✅)
Core (Content Script) - Legacy - NPM (ESM) 47.73 KB 0 B (0% 🟢) 50 KB (✅)
Core (Content Script) - Legacy - NPM (CJS) 47.9 KB 0 B (0% 🟢) 50 KB (✅)
Core (Content Script) - Legacy - NPM (UMD) 47.8 KB 0 B (0% 🟢) 50 KB (✅)
Core (Content Script) - Modern - NPM (ESM) 40.29 KB 0 B (0% 🟢) 41.5 KB (✅)
Core (Content Script) - Modern - NPM (CJS) 40.47 KB 0 B (0% 🟢) 41.5 KB (✅)
Core (Content Script) - Modern - NPM (UMD) 40.32 KB 0 B (0% 🟢) 41.5 KB (✅)
Core (Lite) - Legacy - NPM (ESM) 36.45 KB 0 B (0% 🟢) 39 KB (✅)
Core (Lite) - Legacy - NPM (CJS) 36.7 KB 0 B (0% 🟢) 39 KB (✅)
Core (Lite) - Legacy - NPM (UMD) 36.52 KB 0 B (0% 🟢) 39 KB (✅)
Core (Lite) - Modern - NPM (ESM) 31.79 KB 0 B (0% 🟢) 34 KB (✅)
Core (Lite) - Modern - NPM (CJS) 32.09 KB 0 B (0% 🟢) 34 KB (✅)
Core (Lite) - Modern - NPM (UMD) 31.84 KB 0 B (0% 🟢) 34 KB (✅)
Load Snippet 780 B 0 B (0% 🟢) 1 KB (✅)

@maheshkutty maheshkutty marked this pull request as ready for review May 15, 2026 09:59
@maheshkutty maheshkutty requested a review from a team as a code owner May 15, 2026 09:59
Comment thread packages/analytics-js-integrations/src/integrations/GoogleAds/browser.js Outdated
Comment thread packages/analytics-js-integrations/src/utils/utils.js Fixed
Comment thread packages/analytics-js-integrations/src/utils/utils.js Outdated
Comment thread packages/analytics-js-integrations/src/integrations/GoogleAds/browser.js Outdated
Comment thread packages/analytics-js-integrations/src/integrations/GoogleAds/browser.js Outdated
Copilot AI review requested due to automatic review settings May 18, 2026 05:23
@maheshkutty maheshkutty requested a review from a team as a code owner May 18, 2026 05:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.

Comment thread packages/analytics-js-integrations/src/integrations/GoogleAds/browser.js Outdated
@maheshkutty maheshkutty requested a review from saikumarrs May 18, 2026 05:49
maheshkutty
maheshkutty previously approved these changes May 18, 2026
Copilot AI review requested due to automatic review settings May 20, 2026 10:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 4 changed files in this pull request and generated 3 comments.

Comment thread packages/analytics-js-integrations/src/utils/utils.js
Comment thread packages/analytics-js-integrations/src/integrations/GoogleAds/browser.js Outdated
Comment thread packages/analytics-js-integrations/src/utils/utils.js Fixed
maheshkutty
maheshkutty previously approved these changes May 21, 2026
Comment thread packages/analytics-js-integrations/src/integrations/GoogleAds/browser.js Outdated
rudder-devbox and others added 4 commits May 22, 2026 09:52
Add isValidURL utility with two-step validation (configurable pattern +
strict URL_PATTERN) and apply it to GoogleAds sdkBaseUrl — stripping
trailing slashes, rejecting invalid values with a descriptive error, and
falling back to the default GTM domain when no value is provided.
saikumarrs and others added 2 commits May 22, 2026 09:52
Duplicates isValidURL (and URL_PATTERN) into analytics-js-integrations'
local utils instead of depending on @rudderstack/analytics-js-common.
The dependency was added in this PR to reuse the validator, but pulling
in common couples integrations to every type-only edit in that package
and forces an integrations rebuild + release. Reverts the package.json
and tsconfig include changes. Tracked under SDK-4878 to carve out a
frozen-API shared utilities package long-term.
Copilot AI review requested due to automatic review settings May 22, 2026 04:35
@maheshkutty maheshkutty force-pushed the harness/eb5a3f20-ea69-42b1-a0cb-84c65847c67b-feat-support-custom-sdkbaseurl-in-g-sx5d branch from 546284d to 92d478f Compare May 22, 2026 04:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 5 changed files in this pull request and generated 3 comments.

Comment thread packages/analytics-js-integrations/src/utils/utils.js
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
C Maintainability 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

@maheshkutty maheshkutty merged commit a116355 into develop May 22, 2026
16 of 17 checks passed
@maheshkutty maheshkutty deleted the harness/eb5a3f20-ea69-42b1-a0cb-84c65847c67b-feat-support-custom-sdkbaseurl-in-g-sx5d branch May 22, 2026 04:53
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.

5 participants