Skip to content

Add hooks mechanism for extensible tracking#95

Open
sadjow wants to merge 4 commits intomainfrom
feat/hooks-extensibility
Open

Add hooks mechanism for extensible tracking#95
sadjow wants to merge 4 commits intomainfrom
feat/hooks-extensibility

Conversation

@sadjow
Copy link
Member

@sadjow sadjow commented Feb 11, 2026

This adds a hooks system so module consumers can extend the tracking pipeline with custom marketing parameters (e.g., fbclid, msclkid) or integrate with their own backends.

Three runtime hooks are now available:

  • utm:before-track — decide whether to track the current page visit
  • utm:before-persist — enrich or modify the collected data before it's saved
  • utm:tracked — react after data is persisted (e.g., send to an API)

Hooks can be registered via a Nuxt plugin (nuxtApp.hook(...)) or through convenience methods on the useNuxtUTM() composable (onBeforeTrack, onBeforePersist, onTracked).

Also adds customParams to DataObject so hook consumers have a dedicated place to attach arbitrary data, and includes full integration test coverage for the hooks mechanism.

@sadjow sadjow force-pushed the feat/hooks-extensibility branch from fde6f94 to 12d4f6b Compare February 26, 2026 14:37
@sadjow sadjow marked this pull request as ready for review February 26, 2026 14:37
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