Host & A/B Test Any Page
Advanced guide. This walks through raw REST API calls. For most use cases, the CLI or dashboard is simpler. See the Developer Tools overview if you’re not sure this is what you need.
Why Host on TagadaPay Instead of Your Own Servers?
Use Cases
Every page you deploy gets:
- A unique URL on
*.cdn.tagadapay.com(or your own domain) - Instant global delivery via edge CDN
- Built-in A/B split testing (weighted or geo) on the same URL
- Sticky sessions so returning visitors see the same variant
Prerequisites
TagadaPay account
TagadaPay account
Sign up at app.tagadapay.com and create a store.
API key
API key
Go to Settings → API Keys in your dashboard and generate one. It looks like
xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.curl (or any HTTP client)
curl (or any HTTP client)
All examples use
curl. You can use Postman, httpie, or any language’s HTTP library.The 3-Step Flow
Every deployment follows the same pattern:
After that, you can optionally configure A/B split testing on the mounted route.
Step 1 — Deploy a Page
Create a simple HTML file and deploy it via the API. Assets are sent as base64-encoded strings.1
Prepare your HTML
Any valid HTML works. Here’s a minimal example:
2
Base64-encode the file
3
Call the Deploy API
pluginId and deploymentId from the response — you’ll need them next.Step 2 — Instantiate
An instance is a “live copy” of a deployment, bound to a specific store. You can create multiple instances of the same deployment with different configurations.instanceId from the response.
Instance Config
Theconfig object is optional but powerful. Whatever you pass here is injected into the served HTML as window.__TAGADA_PLUGIN_CONFIG__, making it available to your JavaScript at runtime. This lets you deploy one set of files and customize behavior per-instance without redeploying.
You don’t have to read
window.__TAGADA_PLUGIN_CONFIG__ manually. The TagadaPay Plugin SDK reads it for you and exposes it via tgd.config. Using the SDK is the recommended approach — it also gives you session management, analytics, and funnel navigation out of the box. Reading the global directly is perfectly valid if you want zero dependencies, but for most use cases the SDK is simpler.Additional globals like
window.__TAGADA_STORE_ID__ and window.__TAGADA_ACCOUNT_ID__ (and matching x-plugin-* meta tags) are always injected regardless of the config you pass.Step 3 — Mount
Mounting binds your instance to a hostname so it becomes reachable by visitors.routeId from the response — you’ll need it if you set up A/B testing.
Your page is now live at:
Set Up A/B Testing
You can split traffic on any mounted route. TagadaPay supports two split types:Create a Second Variant
A variant is just another instance. There are two ways to create one:- Different deployment (different files)
- Same deployment, different config
Deploy entirely different HTML/CSS/JS (Step 1), then instantiate it (Step 2). Each variant has its own build assets — useful when the pages are structurally different (e.g. a completely redesigned layout vs. the original).You’ll get a separate
pluginId, deploymentId, and instanceId for the variant.You do not mount the second variant separately. Both variants share the same URL — the split testing system decides which one to serve.
Configure the Split
Call the split endpoint with therouteId from Step 3 and both instance IDs:
- Geo-based
- Weighted (percentage)
Route visitors to different variants based on their country.Visitors from unlisted countries fall back to the first instance.
How Sticky Sessions Work
When a visitor hits a split route for the first time, TagadaPay picks a variant and stores the choice in a sticky session cookie (tgd-session-id). On subsequent visits within stickyDuration seconds (default: 7 days), the same variant is served.
This ensures a consistent experience — a visitor won’t flip between variants mid-session.
Update a Variant
To push a new version of a variant, deploy with"overwrite": true:
Deploying a Full SPA
TagadaPay can host any single-page application (React, Vue, Svelte, etc.). Build your app, then deploy all output files:Advanced: Large File Uploads (> 4 MB)
The
inlineAssets method shown above sends base64-encoded files inside the JSON body. This works well for small pages, but serverless functions have a ~4.5 MB body limit. If your SPA build output is larger — bundled JS, images, fonts — you need the two-step blob upload flow instead.How the blob upload flow works
How the blob upload flow works
Instead of embedding assets in the request body, you:
- Upload a ZIP of your build output to TagadaPay’s blob storage, which supports multipart uploads up to 50 MB.
- Deploy from the blob URL — pass the returned URL to the deploy endpoint, which downloads and extracts the ZIP server-side.
Step-by-step with curl
Step-by-step with curl
1
ZIP your build output
2
Get an upload token
The upload token endpoint implements a client upload protocol. You need to call it twice: once to get a token, then once more to confirm completion. In practice, use the
@vercel/blob client library — it handles both calls for you.3
Deploy from the blob URL
Now pass the blob URL to the V2 deploy endpoint using the The server downloads the ZIP, extracts all files, and uploads each one to blob storage — exactly like
zipUrl parameter instead of inlineAssets:inlineAssets, but without the body size limit.4
Continue as usual
From here, the flow is identical: instantiate → mount → optionally configure A/B testing. The
pluginId and deploymentId from the response are the same as with inline assets.When to use which method
When to use which method
Custom Domain
By default your page is served on*.cdn.tagadapay.com. You can mount it on your own domain instead using the Domains API.
1
Register the domain
Call the domains API to add your domain to TagadaPay. This registers it with the edge network and returns a verification token.Response:Save the
id — you’ll use it to verify.2
Configure DNS
Add the required DNS records at your registrar. You need a CNAME pointing to
cname.vercel-dns.com:Wait for DNS propagation (usually a few minutes, can take up to 48h).
3
Verify the domain
Once DNS has propagated, call the verify endpoint:A successful response looks like:
4
Mount on the custom domain
Once verified, mount your instance using the Your page is now live at
customDomain field:https://landing.yourstore.com/.API Reference
Write Operations
Read Operations
Funnel Operations
All endpoints require
Authorization: Bearer YOUR_API_KEY and Content-Type: application/json.
Troubleshooting
404 after mounting
404 after mounting
Make sure the
hostname in the mount request matches the URL you’re visiting.
Format: {slug}--{storeId}.cdn.tagadapay.comDouble-check that basePath is / and matcher is /.A/B test always shows the same variant
A/B test always shows the same variant
Sticky sessions may be pinning you to one variant. Clear your cookies or use incognito mode to get a fresh session. For geo testing, the system reads the visitor’s country from the edge network — make sure you’re testing from the expected country or use a VPN.
Assets (CSS/JS) return 404
Assets (CSS/JS) return 404
Ensure each asset’s
path in inlineAssets matches the path referenced in your HTML.
For example, if your HTML has <script src="/assets/app.js">, the asset path must be /assets/app.js.Deploy fails with 'Plugin name is required'
Deploy fails with 'Plugin name is required'
The
manifest object requires at minimum: name, version, and pages (array with at least one entry). Each page needs id, path (starting with /), and name.Next Steps
Plugin SDK
Add session management, payment processing, and funnel navigation to your pages
Plugin CLI
Automate deployments with the CLI instead of curl
API Reference
Explore all available API endpoints
Custom Domains
Use your own domain instead of the default CDN hostname
