Skip to content

Add hooks mechanism for extensible tracking#95

Draft
sadjow wants to merge 1 commit intomainfrom
feat/hooks-extensibility
Draft

Add hooks mechanism for extensible tracking#95
sadjow wants to merge 1 commit 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.

Co-authored-by: Luis David Barrera Díaz <dbarrera@stackbuilders.com>
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