Skip to content

Document BuildJsScope model and split tracking scripts#601

Draft
promptless-for-oss wants to merge 1 commit into
mautic:7.2from
Promptless:promptless/pr-16660-mtc-script-split-7.2
Draft

Document BuildJsScope model and split tracking scripts#601
promptless-for-oss wants to merge 1 commit into
mautic:7.2from
Promptless:promptless/pr-16660-mtc-script-split-7.2

Conversation

@promptless-for-oss

Copy link
Copy Markdown
Contributor

Updates the MauticJS tracking script developer page (docs/mauticjs_api/tracking_script.rst) to document the JS build scope model introduced in mautic/mautic#16660 ("Split mtc.js into essential and tracking scripts", MTC-11100).

New developer-facing surface documented:

  • The Mautic\CoreBundle\Event\BuildJsScope enum (RUNTIME, ESSENTIAL, TRACKING).
  • BuildJsEvent::appendJsForScope($js, BuildJsScope $scope, $section = '') and acceptsScope(BuildJsScope $scope): bool, with plugin-style PHP subscriber examples.
  • A note that legacy appendJs() now delegates to appendJsForScope() with BuildJsScope::TRACKING, plus a backward-compatibility warning (with argument-position migration guidance) that appendJs()-only subscribers are excluded from /mautic-essential.js.
  • The generated endpoints (/mautic-essential.js, /mautic-tracking.js, /mtc.js) and their scope mappings.
  • Client-side runtime globals (MauticJS.runtimeReady, trackingEnabled, requestWithCredentials) and the mauticEssentialReady event, with a safe dual-path readiness guard example.

Source PR: mautic/mautic#16660

This documentation update was prepared by Promptless.

Documents the JS build scope model from mautic/mautic#16660: the BuildJsScope
enum, BuildJsEvent::appendJsForScope()/acceptsScope(), the /mautic-essential.js
and /mautic-tracking.js endpoints, client-side runtime globals, and the
backward-compatibility impact on legacy appendJs() subscribers.
@adiati98 adiati98 added this to the 7.2 milestone Jul 24, 2026
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.

2 participants