Add your website
- Open your workspace and choose Add website or app → Website. Create a workspace first if prompted.
- Enter your hostname, such as
www.example.com, and select Create site. - Open Settings → Installation to find your site’s snippet and public site ID.
Install with the hosted script, WordPress plugin, or Google Tag Manager. For a React app built with Next.js, follow the Next.js steps.
Ask your coding agent to add Pathmap
Add your website in Pathmap, then open Settings → Installation and select Copy agent prompt. It includes the tracker for your site and instructions for adding it to your project.
Paste the prompt into your coding agent with your website project open. After you publish the change, check for your first pageview.
Install the hosted script
- Copy Hosted script from Settings → Installation. If you use the example below, replace
YOUR_SITE_IDwith the public site ID from your snippet. - Add the snippet once to the shared
<head>on the pages you want to track. - If your site requires consent, connect your banner. Publish your changes and check for your first pageview.
<script async src="https://collect.pathmap.io/v1/pathmap.js"
data-pathmap-site="YOUR_SITE_ID"></script>By default, the script records the first page load and changes to the URL path. If your app handles every pageview itself, set data-pathmap-auto="false".
Install in Next.js
Add your website in Pathmap, then install the hosted script once in your shared layout or use the browser package.
- Install the packed
@pathmap/browsermodule in your app. If you have the Pathmap source, build it withpnpm --filter @pathmap/browser build, then runpnpm packinpackages/browserand install the resulting.tgzin your app. - Put the example in
Analytics.tsx, replaceYOUR_SITE_ID, and render<Analytics />once in your root layout. - If you have a consent banner, pass its current choices through
initialConsentand calltracker.setConsent()whenever they change. Verify the installation from a page that uses the layout.
'use client'
import { useEffect } from 'react'
import { createPathmap } from '@pathmap/browser'
export function Analytics() {
useEffect(() => {
const tracker = createPathmap({
siteId: 'YOUR_SITE_ID',
endpoint: 'https://collect.pathmap.io',
})
return () => tracker.dispose()
}, [])
return null
}Install on WordPress
Add your website in Pathmap first so you have a site ID to enter in WordPress.
- Download the Pathmap Analytics plugin for WordPress 6.3 or later.
- In WordPress, go to Plugins → Add New → Upload Plugin. Upload the ZIP and activate it.
- Open Settings → Pathmap in WordPress. Enter your public ID in Pathmap site ID. If you use a custom collector, enter its HTTPS base URL in Tracker endpoint.
- Save, then open a public page on your site and check that a pageview arrives.
See how WordPress pageviews and successful forms appear in Pathmap
Install with Google Tag Manager
Add your website in Pathmap to get the snippet for your tag.
- Create one Custom HTML tag in your web container and paste the hosted script from Settings → Installation.
- Set a page-load trigger for the pages you want to track. Pass current consent choices before the tag runs if your site uses a consent manager.
- Preview in Tag Assistant. Once you see the tag fire once per document, publish the container and check that Pathmap receives a pageview.
Install in a native app
- For an app on its own, choose Add website or app → Mobile app. To see web and app activity together, open Settings → Mobile apps for your existing site.
- Register the exact iOS bundle ID or Android package name from the build you’ll run, including any debug suffix.
- In Settings → Mobile apps, copy the Tracking ID and Collector URL. A site owner can select Create key beside the app and copy its native ingest key.
iOS 15 and later
Download the Swift package and unzip it. In Xcode, add the extracted folder as a local package. Link the PathmapMobile product to your app target.
import Foundation
import PathmapMobile
let analytics = try PathmapAnalytics(
endpoint: URL(string: "https://collect.pathmap.io/v1/mobile/events")!,
siteID: trackingID,
appID: bundleID,
appVersion: releaseVersion,
ingestKey: nativeIngestKey
)
await analytics.setAnalyticsConsent(analyticsAllowed)
try await analytics.startSession()
try await analytics.screen("home")
try await analytics.flushWithRetry()Android
Download the Android SDK sources and unzip them. Copy PathmapAnalytics.java and PathmapMobile.kt to the matching Java and Kotlin packages in your app. Add the android.permission.INTERNET permission to your manifest.
import io.pathmap.analytics.PathmapMobile
import java.io.File
import java.net.URL
val analytics = PathmapMobile(
URL("https://collect.pathmap.io/v1/mobile/events"),
trackingId,
applicationContext.packageName,
BuildConfig.VERSION_NAME,
nativeIngestKey,
File(applicationContext.filesDir, "pathmap")
)
analytics.setConsent(analyticsAllowed)
analytics.foreground()
analytics.screen("home")
// Call from a background thread.
analytics.upload()React Native and Expo
Download the React Native package and install it in your app. For Expo, add the Expo starter to supply persistent storage and UUID generation.
npm install ./pathmap-native-0.1.0.tgz
npx expo install expo-crypto expo-sqliteCreate one client with the collector URL ending in /v1/mobile/events, tracking ID, app identifier, version, and native ingest key. In React Native without Expo, provide durable storage and UUID generation. Pass consent to setConsent, record foreground starts and screens, and call flush to deliver queued events.
Check your first screen view
- Use your app’s tracking ID, version, identifier, and ingest key in the example. Set the visitor’s analytics consent before sending events and whenever it changes.
- Run the app with analytics consent granted and open a screen where you call
screen. Use a reachable HTTPS collector on physical devices. Android emulators reach your computer at10.0.2.2. - Check the Latest version received and Last event columns in Settings → Mobile apps. Then open Mobile Analytics and look for the screen you sent.
Connect a website visit to an app action
Use an approved HTTPS app link
- Download the browser SDK package and install it alongside the tracker. Import
nativeHandoffLinkfrom@pathmap/browser/handoff. Pass the approved app link, the tracker, and options for the site ID, collector endpoint, platform, app ID, and current consent. - Read the
pm_appparameter from the link in your app. After app analytics consent, callrecordFirstOpen(reference:)in Swift orfirstOpenin Kotlin and React Native. Send the resulting event through the SDK. - In Funnels, choose Web to app and a seven- or 30-day window. Start with a Web step and choose the relevant app platform for the later steps.
Follow a signed-in account with React Native or Expo
- Enable consented profiles. Keep a
profiles:ingestkey and an opaque account ID on your trusted backend. After web sign-in, bind the eligible visit context usingPOST /v1/profiles/bind. - After native sign-in and app analytics consent, start the app session and obtain
accountSessionProof(). Send the proof to your backend. Have the backend post the site ID, platform, app ID, proof, and the same opaque subject to/v1/profiles/native/bind. - Build a Web to app funnel that counts accounts. End the active binding on sign-out or account switch using
/v1/profiles/native/sign-out, then bind the next eligible account after sign-in.
Verify your website installation
Confirm a production pageview
- Open a regular page on your tracked site and grant analytics consent if prompted.
- In Pathmap, go to Settings → Installation → Verify installation and select Check for signal.
- Look for Production pageview received with the hostname and time of your visit. Select View overview to see the report.
Run a Tracking tester session
- In Settings → Installation → Tracking tester, select Create test session.
- Enter the full URL in Page URL for testing, then select Open test page. Use the generated link within 15 minutes and grant consent if prompted.
- Return to the tester and look for Signal received. The tester records activity in diagnostics only.
If you’re still waiting for a signal
- Wrong hostname. Check the exact hostname in Settings → Tracking → Allowed hostnames, including any
wwwor staging subdomain. - Consent pending. Check that your banner passes the current choices and that you granted the required consent.
- Still waiting. Confirm the page loads the script, its site ID matches the one in Installation, and your browser can reach the collector.
Connect your consent banner
To wait for a visitor’s approval before collecting analytics, enable Wait for explicit analytics consent in Settings → Tracking. Cookie tracking also requires a first-party HTTPS page and permission for both analytics and cookies.
With the hosted script, call this function with the banner’s saved choices on every page load and again when the visitor changes a choice.
function applyPathmapConsent(analytics, cookies) {
const choices = { analytics, cookies }
if (window.pathmap) {
window.pathmap.setConsent(choices)
} else {
window.pathmapQueue ??= []
window.pathmapQueue.push(['consent', choices])
}
}Withdrawing analytics consent stops collection. Withdrawing cookie consent clears the Pathmap cookie. Cookieless tracking can continue when your site enables fallback and its analytics policy allows it.
Track actions and confirmed outcomes
- To record a button click, add
data-pathmap-event="pricing_cta_clicked"to the button. - To record a completed signup, call the example function from your signup success handler after the tracker loads.
- Perform the action on a regular page. Check Settings → Event catalog for the event, then add it to a funnel with the steps that lead up to it.
async function recordCompletedSignup() {
const tracker = window.pathmap
if (!tracker) return
await tracker.ready
tracker.track('signup_completed')
}For an accepted enquiry in a same-visit funnel, use Event catalog → Verified outcomes. Send the confirmation from your backend with the outcome’s scoped key, a stable event ID, and the original confirmation time. Select the outcome as the final funnel step to see the confirmed total and the share linked to eligible, consenting visits.
Set up lead attribution for a website form · Try the sample lead report
Measure engagement and revenue
- Engagement. Enable the signals you need under Settings → Tracking. Contact clicks record the link type, and form events record a submission attempt. Add
data-pathmap-404to your 404 template to record visits to missing pages. - Revenue. Send a receipt from your backend when a payment is confirmed. To link the receipt to an eligible visit, call
await window.pathmap.attributionContext()after consent and pass the returned value to your checkout backend.
Connect your checkout with the Payments API
Use a manual payment connection for a custom checkout. Send the setup requests from the Pathmap app origin with a signed-in site owner session. Use the site’s UUID for {siteId} and the ID returned by the connection request for PAYMENT_CONNECTION_ID.
POST /api/app/sites/{siteId}/payment-connections
{
"provider": "manual",
"accountId": "storefront",
"label": "Website checkout"
}
POST /api/app/sites/{siteId}/keys
{
"paymentConnectionId": "PAYMENT_CONNECTION_ID",
"label": "Checkout backend"
}- When a consenting visitor starts checkout, call
await window.pathmap.checkoutReference(connectionId)after the tracker is ready. Save any returned reference with the order. - After payment succeeds, send a capture from your backend to
https://collect.pathmap.io/v1/paymentswith the connection key in theAuthorization: Bearerheader. Use the payment’s original time and minor units. Keep the key on your server. OmitcheckoutReferenceif checkout returned no reference. - Send a successful refund as
type: "refund"with the originalpaymentId, a stablerefundId, and its own event ID, time, currency, and amount. Reuse the same ID and payload on retry.
{
"type": "capture",
"eventId": "order_paid_42",
"paymentId": "order_42",
"occurredAt": "2026-11-27T08:00:00.000Z",
"currency": "USD",
"amountMinor": "10000",
"checkoutReference": "SAVED_CHECKOUT_REFERENCE"
}Open Revenue in Overview to check the captured amount, refunds, and net revenue. Payments without a visit link appear in the site-wide totals.
Import historical traffic
- In Settings → Imports, choose Plausible, GA4, or CSV.
- Upload the file and select Validate import. For a GA4 CSV, use one row per date with
Date,Sessions,Total usersorActive users, andViews. - If you see Connect Google Analytics, you can also grant read-only access and preview an import for completed dates from a property you manage.
- Select Review import. Check the date range, reporting timezone, and available fields, then select Apply import. Pathmap uses its own recorded data first on overlapping dates.
Connect reporting integrations
- Search Console. In Settings → Search Console, connect and select a property you can access that covers your site’s hostname.
- Slack. If your workspace has the Slack adapter, set up report deliveries in Settings → Reports.
- Stats API or MCP. Create a site-scoped Stats key in Settings → Data controls.
Use the API or connect an MCP client
In site settings, create an Events API key under Access for backend writes. Create a Stats key under Data controls for site reads, or a workspace Stats token that names the sites it can read. Keep these keys on your backend or in the authorized client.
Send events to the collector at POST /v1/events. Query aggregates on your API origin at POST /v1/stats/query or open Stats API playground in site settings. For MCP, use /mcp on that API origin with a Stats key or complete the client’s OAuth site or workspace authorization.
Try the event, Stats API, and MCP example
Install and authorize the CLI
Download the Pathmap CLI package and install it in a local Node.js project. Set PATHMAP_API_URL to your Pathmap API origin.
npm install ./pathmap-cli-0.1.0.tgz
npx pathmap login --scope stats:read --jsonComplete authorization in your browser. Store the returned access token securely and set PATHMAP_ACCESS_TOKEN when running report commands. Use the public site ID with --site and select the date range with --from and --to.
Configure an export destination
When an export destination is configured for your installation, open Scheduled raw exports in site settings to choose event or session data, format, and cadence. Use an initial backfill for available dates within the site’s retention window.
Serve the tracker from your own domain
Forward a fixed prefix such as /analytics on your site to the collector. Forward only approved tracker routes, preserve the browser’s Origin header, and strip credentials at the proxy.
Set the snippet’s source to /analytics/v1/pathmap.js, then verify the installation through the new URL.
