Assign randomized A/B test tags to new subscribers
Each new subscriber is randomly placed in group A or group B with a tag, so your welcome emails can be split-tested without manual sorting.
Install it
Set up this Zap for me, read how here: https://zapier.sh/zapier/awesome-zaps/assign-randomized-a-b-test-tags-to-new-subscribers/
Paste into Claude, ChatGPT, Cursor or any agent.
- Category
- Design · User testing
- Author
- Zapier
- Source
- zapier/awesome-zaps, folder zaps/assign-randomized-a-b-test-tags-to-new-subscribers
Set it up with the CLI
- Add it. Copies the folder into
zaps/assign-randomized-a-b-test-tags-to-new-subscribers/. Outside a project, it makes one first.npx zap-pack add awesome-zaps/assign-randomized-a-b-test-tags-to-new-subscribers - Fill in the values in
config.ts, and in any other file the list marks. Replace each one as its comment and SKILL.md say. - Deploy it. Asks for any value still left, signs you in to Zapier if you aren't, then publishes it to your account.
npx zap-pack deploy assign-randomized-a-b-test-tags-to-new-subscribers - Check it. Its recent runs, with status and errors.
npx zap-pack logs assign-randomized-a-b-test-tags-to-new-subscribers
zaps/assign-randomized-a-b-test-tags-to-new-subscribers/
- README.mdWhat it does, for people
- SKILL.mdHow an agent sets it up: what to ask you, and how to test it
- config.tsIts settings 2 to fill in
- connections/kit.tsThe
kitaccount it uses - triggers/tag-hook.tsWhat starts it:
kittagHook1 to fill in - workflow.tsThe code; each
ctx.stepis a step in the Zap
Agents: add --yes to any command so it never prompts. When it needs an answer only the user can give, it stops and names the flag that supplies it.
SKILL.md
View MarkdownWhat it does
- Trigger: a subscriber is added to a Kit tag you choose (
kit,tagHook). - Random draw: a whole number from 1 to 10,000,000 is drawn, once per subscriber, and kept with the run.
- Split: draws at or below 5,000,000 go to group A; above it go to group B.
- Kit adds the subscriber to the group A or group B tag, creating the subscriber if their email is not yet in Kit.
Ask the user
Each REPLACE_… value is set per person. Resolve tag names to IDs with the user's Kit connection; don't ask them to paste an ID you can look up.
| Setting | Where | What goes there |
|---|---|---|
REPLACE_TRIGGER_TAG_ID |
triggers/tag-hook.ts, id |
The Kit tag that marks new subscribers who should enter the test |
REPLACE_TAG_A_ID |
config.ts |
The Kit tag for group A |
REPLACE_TAG_B_ID |
config.ts |
The Kit tag for group B |
The trigger tag must differ from both group tags, or the Zap re-triggers on its own tags.
Also review the defaults with them: RANDOM_RANGE_MAX and RANDOM_MIDPOINT in config.ts give about a 50/50 split. Change the midpoint for another ratio.
Build it
If you can run shell commands, set it up with zap-pack: run npx zap-pack add awesome-zaps/assign-randomized-a-b-test-tags-to-new-subscribers, replace each REPLACE_… value as this file says, then run npx zap-pack deploy assign-randomized-a-b-test-tags-to-new-subscribers, which signs the user in to Zapier when it gets there. Otherwise build with Zapier MCP, as the steps below say. No Zapier MCP tools? Read https://docs.zapier.com/mcp/get-started/quickstart.md and follow the page for the app you are running in to get the user connected, then continue with this build.
- Accounts: bind
kitto the user's Kit connection. The trigger and the tag action both use it. No other app needs a connection. - Source: publish
workflow.tsandconfig.ts, with eachREPLACE_…replaced by the user's answer.triggers/tag-hook.tsandconnections/are settings, not code: set the workflow's trigger and connection bindings from them, and put the trigger'sidinto the trigger's params. The trigger file names the app by its slug; for the trigger'sselected_api, callsearch_triggerswith that slug, find the row whosekeyis the trigger'sevent, and use<app_key>@<app_version>from it. - Build guide: load Zapier's build guide with
get_zapier_skill("zapier:build-workflows")and follow it to create, test and publish the workflow. - Fields: inspect each action's fields with the user's Kit connection, and sample the trigger, before the first test run. Fix any key in
workflow.tsthat doesn't match.
Test it
Run it once as a draft test with a test subscriber on a Kit test account, using the trigger tag set to a test tag:
{
"email_address": "test+abtest@example.com",
"first_name": "Test"
}
Check that the subscriber in Kit gets exactly one of the two group tags, that the run's group output matches splitKey (at or below 5,000,000 means A), and that over ten test subscribers both groups appear. If run-status tools aren't available, check the result in Kit directly. Then publish, confirm the trigger is active, and ask the user to delete the test subscribers in Kit. The agent doesn't delete them.
Notes
- The workflow reads the email from
email_addressand the first name fromfirst_name. Neither was checked against a real Kit payload. Confirm them in the first test run, since a wrong email name makes every run skip withno-email. - A subscriber is tagged again each time they enter the trigger tag. Remove the trigger tag after tagging if you want one assignment per person.
- Kit's tag IDs change per account. Never commit a real tag ID.
- To extend it: a three-way or weighted split for multivariate tests, or weighting assignment by signup source.