Location: Integrations → Snippets, Numbers → Number pools, Integrations → Reporting, Custom Tags
Use case: Record affiliate IDs as visit and call metadata when multiple affiliates share one landing page
Moja captures affid as visit and call metadata. You can view it in the call's tracking details or send it to another system through a webhook. This does not automatically assign the call to a Moja Publisher or campaign, calculate an affiliate payout, or create an affiliate reporting dimension.
The default snippet setup is documented in DNI, Tracking Tags/Snippets, and Number Pools.
When to use which setup
Goal | Recommended setup |
Record the affiliate ID from the visitor's URL | One snippet, one Number to Replace, one number pool, and a unique |
Send the affiliate ID through a webhook | Use the |
Give each affiliate its own number pool, Moja campaign, or Publisher attribution | Use a separate snippet for each affiliate and make the page load exactly one affiliate-specific snippet |
Unique URL parameters identify the affiliate as external metadata. Unique fallback numbers or number pools do not, by themselves, create Moja Publisher or campaign attribution. Moja determines the campaign and Publisher from the snippet's default number.
Where to configure this
You will configure and verify this setup in:
Integrations → Snippets — create and manage snippets. This option is currently available to administrators.
Numbers → Number pools — create and manage DNI number pools.
Integrations → Reporting — open a call's tracking details and review its landing-page data.
Custom Tags — create an
affidCustom Tag if the value must be available as a standalone call-flow or webhook tag.
Default path: one snippet, one pool, unique affid
Create or select the snippet, then install it in the landing page
<head>.After creating the snippet, confirm that Enable Number Replacement and Capture User Data both show Enabled. Capture User Data must be enabled for Moja to store
affidand the other landing-page parameters.Assign one number pool and one Number to Replace.
Give each affiliate a unique link while keeping the parameter name consistent:
Affiliate A:
https://example.com/landing?offer_id=123&affid=affiliate-aAffiliate B:
https://example.com/landing?offer_id=123&affid=affiliate-b
The snippet captures affid automatically under All URL Parameters. There is no built-in AFFID system tag. Parameter names are case-sensitive for downstream use, so use the same spelling and casing in every affiliate link.
If the visitor is redirected before reaching the landing page, every redirect must preserve affid.
Verify the captured affiliate ID
To verify the captured affiliate ID:
Open Integrations → Reporting.
Find and open the test call's tracking details.
Locate All URL Parameters.
Confirm that
affidcontains the expected affiliate ID.
The affiliate ID shown here is landing-page metadata. It does not mean that the call was assigned to a corresponding Moja Publisher or campaign.
Send affid through a webhook
Add [URL_PARAMETERS] to an outgoing webhook when you want to send all captured URL parameters. This placeholder produces a JSON-encoded string, not a nested JSON object.
For example:
{
"url_parameters": "[URL_PARAMETERS]"
}
can produce:
{
"url_parameters": "{\"offer_id\":\"123\",\"affid\":\"affiliate-a\"}"
}
The receiving system must parse the url_parameters value if it needs a JSON object.
Optional: create an affid Custom Tag
If you need a standalone [AFFID] tag in call flows or outgoing webhooks:
Open Custom Tags.
Create a Custom Tag named
affid.Continue passing
affidin the visitor's URL.Place a test call and confirm that the tag is available to the call flow or webhook.
Once the affid Custom Tag exists, Moja can promote the URL parameter into the call's custom tags. You normally do not need to duplicate the value with window._moja_tags.
Use window._moja_tags only when the landing page deliberately needs to submit a separate custom-tag value:
<script>
const params = new URLSearchParams(window.location.search);
window._moja_tags = window._moja_tags || [];
window._moja_tags.push({
affid: params.get('affid')
});
</script>
The corresponding Custom Tag must still exist in Moja before it can be used as a call-flow or webhook tag.
Separate pools, campaigns, or Publishers for each affiliate
Use a separate snippet for each affiliate when each affiliate must have its own number pool, Moja campaign, or Publisher attribution.
For each affiliate:
Create or select an affiliate-specific fallback number.
Create or select the affiliate's number pool.
Select a default number associated with the intended Moja campaign and Publisher.
Create a snippet using that fallback number as the Number to Replace and that pool as the snippet's default pool.
Configure the shared landing page to load exactly one snippet based on the validated affiliate identifier.
Continue including
affidin the URL for reporting and downstream reconciliation.
Do not load every affiliate's snippet on the same page. The page must select and load only the snippet belonging to the current affiliate.
Do not rely on the Additional Numbers DOM Selector to isolate affiliate placements. The current snippet stores that setting but does not use it to scope number allocation or replacement.
Do not rely on the Additional Numbers Campaign ID to assign a call to a specific campaign. The allocation service does not currently use that field for backend campaign or Publisher attribution.
The current multi-number implementation requests a replacement number for every configured target when the snippet initializes, even when a target does not appear on the page. For that reason, one shared multi-number snippet is not recommended for per-affiliate pool isolation.
When using one affiliate-specific snippet per visitor, size each pool for the maximum number of simultaneous active visitors expected for that snippet, plus operational headroom.
If a shared multi-number snippet is used despite the limitation above, every configured pool may receive allocation requests from the shared page's total visitor traffic—not only traffic from the affiliate associated with that pool.
How to test
Test one affiliate completely before starting the next:
Close all existing private-browsing windows.
Open Affiliate A's link in a new private session.
Confirm that the expected number replaces the fallback number.
Place the call.
Confirm Affiliate A's
affidunder All URL Parameters.Close all private-browsing windows.
Repeat the entire process for Affiliate B.
Confirm that the second test uses a different Moja visitor ID.
Opening another private window while the first private session remains open may reuse the same stored visitor ID.
Troubleshooting
Calls are tracked but affid is missing
Confirm the visitor called the dynamically inserted number.
Confirm the landing-page URL still contained
affidwhen the snippet loaded.Open the call in Integrations → Reporting and check All URL Parameters.
Confirm Capture User Data shows Enabled on the snippet.
The number is not being replaced
Confirm the snippet is in the page
<head>and Enable Number Replacement shows Enabled.Confirm Number to Replace matches the number shown on the page.
Confirm the assigned pool has available numbers.
Pool exhaustion in multi-number mode
In multi-number mode, an exhausted pool does not fall back to the snippet's default number. The affected target remains unreplaced. Confirm that every active pool has enough available numbers before testing or publishing the page.
Summary
Use one snippet and one pool when you only need to record affid as external affiliate metadata. Use separate affiliate-specific snippets when the affiliates require separate pools, campaigns, Publishers, routing, or payouts. Treat affid as metadata unless a corresponding Moja Custom Tag, Publisher, campaign, and snippet configuration have been created explicitly.
Related articles
