Browser container and server SDK
Add approved tracking to your website and backend with the right keys.
What you need
First approve the plan and prepare it for testing. Your agent needs the plan’s conversion and target IDs, the current installation version (installation_generation), and your public browser key. Server code needs Tyton’s private @tyton/sdk build with the required exports; the public npm package tyton is not that build.
Browser installation
- Add the v2 browser script once. Replace the placeholder with your public browser key only:
<script src="https://ingest.usetyton.com/v2/container.js"
data-key="REPLACE_WITH_PROJECT_PUBLIC_KEY"
data-consent="wait"
data-mode="verify"></script>- Connect your consent manager’s permission and withdrawal actions. Once the script is ready, call the planned conversion only after your app confirms success:
await window.tyton.conversion(conversionId, targetId, {}, {
installationId: stagedGeneration,
eventId: confirmedSubmissionId,
verify: true,
});- Test each planned browser or server source and a failed action. Once Tyton shows tracking is active, remove verification settings and reload the site. Adding the script alone does not connect your business actions.
The private @tyton/sdk/browser supports init({ project, consent: 'wait', mode: 'verify' }). Choose one installation method. Imports are SSR-safe; initialization requires a browser.
Server callback
This example belongs inside the backend code that verifies a successful payment. Get every value from the approved plan or confirmed payment, never from an untrusted browser claim:
import { init } from '@tyton/sdk/server';
const tracking = init({ secretKey: process.env.TYTON_SECRET_KEY! });
const result = await tracking.conversion(conversionId, targetId, {
orderId: paymentOccurrenceId,
value: confirmedAmountInMajorUnits,
currency: confirmedCurrency,
}, {
installationId: stagedGeneration,
eventTime: confirmedAtUnixSeconds,
verify: true,
context: { sourceUrl: actualShopperUrl, userAgent: actualShopperUserAgent },
});For USD, 49 means $49, not 49 cents. Preserve the ID and timestamp on retries. Await the result within the request lifetime. identify() returns a separate client; it does not mutate the base client. Use anonymous clients during verification.
Success check and troubleshooting
verified means the planned call ran in test mode. queued means Tyton accepted an event for delivery. unknown means acceptance is still uncertain. See delivery statuses.
In live mode, decide who loads the Meta Pixel. auto cannot tell who owns an existing fbq call; external means your site loads it; tyton allows Tyton to load it. If Tyton reports ownership_unknown, inspect the current installation before adding another Pixel. If the private SDK or approved tools are unavailable, pause that part of setup rather than sending raw events outside the plan.