Skip to main content

External Page Tracker

The External Page Tracker is a lightweight JavaScript snippet that connects your external pages to the TagadaPay funnel system. It enables accurate analytics (device, browser, OS), session tracking, and funnel navigation on pages not hosted on TagadaPay.
This is essential for WooCommerce stores, WordPress sites, custom landing pages, or any external page that is part of your funnel. Without the tracker, analytics data will be inaccurate (e.g., showing the server’s User-Agent instead of the visitor’s browser).

Why You Need This

When a funnel includes steps hosted outside TagadaPay (e.g., your WooCommerce store), the TagadaPay platform has no visibility into what happens on those pages. The External Page Tracker solves this by:
  1. Creating a session — authenticates the visitor and creates an anonymous token
  2. Tracking page views — records which funnel step the visitor is on
  3. Capturing real device data — sends the actual browser User-Agent, screen size, and device info (instead of a server-side PHP User-Agent)
  4. Enabling funnel navigation — allows the visitor to move to the next step via JavaScript
  5. Preserving identity — maintains the same customer identity across TagadaPay-hosted and external pages

Quick Start

Add this before the closing </body> tag on your external page:

Option 2: NPM Package

You can find your storeId, accountId, and stepId in the TagadaPay dashboard under Storefront → [Your Funnel] → External Step → Tracking Script.

Configuration

Required Parameters

Optional Parameters

Callbacks

When onError is not provided, init() will throw on failure. Always use onError or wrap init() in a try/catch.

API Reference

TagadaTracker.init(config)

Initialize the tracker. Must be called once per page load. Returns a Promise<ExternalTrackerSession | null>.
The returned session object:

TagadaTracker.navigate(options)

Navigate to the next funnel step. By default, this redirects the browser automatically.

TagadaTracker.trackEvent(options)

Track a custom event for analytics without navigating. Non-blocking — errors are silently swallowed.

TagadaTracker.buildUrl(baseUrl, params?)

Build a URL that preserves funnel session context. Use this when linking to other external pages within the same funnel.

TagadaTracker.reset(newStepId)

Reset the tracker to a different step without re-creating the session. Useful for single-page applications.

TagadaTracker.destroy()

Clean up the tracker, remove event listeners, and clear state. Call this when the tracker is no longer needed.

Utility Methods


Examples

WooCommerce / WordPress

If you’re using the TagadaPay WooCommerce plugin, the tracker is injected automatically. No manual setup needed. For manual integration, add the tracker to your theme’s footer.php:

Landing Page with CTA Button


Lead Capture Form


Single Page App (React)


How It Works Internally

  1. init() is called — validates config, creates an anonymous session token via POST /api/v1/cms/session/anonymous
  2. Session initialized — sends device/browser data via POST /api/v1/cms/session/v2/init
  3. Funnel registered — tells the orchestrator which step the visitor is on via POST /api/v1/funnel/initialize
  4. onReady fires — session is ready, page view is tracked
  5. navigate() called — sends navigation event, orchestrator determines the next step URL, browser redirects
All API calls include the real browser User-Agent, screen resolution, and device data — ensuring accurate analytics.

Troubleshooting

Make sure you’re passing a valid storeId string. Check the TagadaPay dashboard for your store ID.
The accountId parameter is required since v1.0.0. Find it in your TagadaPay dashboard under Settings → Account.
This means session initialization is happening server-side (PHP) instead of client-side. Make sure the External Page Tracker script is loaded in the browser, not called from PHP.
The tracker bundle may be outdated. Make sure you’re using the latest version from the CDN. Clear your browser cache or add a version query parameter: ?v=1.0.0.
Make sure you’re using the latest tracker version (1.0.0+). Older versions had a bug where both the tracker and the SDK client would independently initialize the funnel.

Next Steps

Trigger Checkout

Create checkout sessions from any website

Plugin SDK

Build full custom checkout experiences

Funnels

Learn about multi-step funnels

API Reference

Full REST API documentation