Skip to main content

@traveloka/core/tracking

This module pertains to how we collect tracking data.

Important files

  • Internal tracking

    • packages/core/tracking/useTracker.ts — For use in react
    • packages/core/tracking/trackServerSide.ts — For use in server-side/middleware (as we need to pas req)
  • Page view tracking

    • packages/core/tracking/PageViewTracker.ts — A component (included in withTravelokaApp) that fires "page view" tracking using the hooks below
    • packages/core/tracking/useTrackPageView.ts — The recommended hook to fire "page view"
    • packages/core/tracking/usePageViewTracker.ts — Implementation detail to populate the data for "page view" tracking. Read the supplied documents for the semantic of the tracking behavior, e.g. how we handle incoming visit from Traveloka or externak site.
  • External tracking

    • packages/core/tracking/external/ExternalTrackingManager.tsx — Utility to utilize external-party tracking (this handles lazy-loading of the necessary scripts).