Marketing and Affiliates TCP API¶
The marketing subsystem tracks acquisition from the first brand-host visit to customer registration.
Data model¶
| Entity | Purpose |
|---|---|
| Campaign | Brand-scoped acquisition campaign and channel metadata |
| Affiliate | Global partner identity with a public affiliate code |
| Affiliate brand access | Makes an affiliate available to one brand and stores its default campaign, manager, and primary link |
| Marketing link | Long tracking URL generated from the brand terminal_host |
| Brand app | App Store or Google Play destination and attribution window |
| Touch | Captured page visit, app click, app activation, or external registration |
| Customer attribution | Attribution selected when a customer is registered |
Affiliate and campaign codes are public identifiers. They are not authentication credentials. The server persists a code only if the record is active and valid in the resolved brand.
Brand scope¶
CRM managers are restricted to the brand from their current staff access record. Admin-scoped managers may address an explicit brand or list records across brands where the command allows an empty filter.
Generated links always use the configured BrandRecord.terminal_host. A caller cannot supply a replacement host.
Access¶
Marketing management commands accept SESSION_MANAGER, SESSION_ADMIN, SESSION_CRM_MANAGER, and SESSION_CRM_ADMIN.
- read commands require
access_crmandsee_customers; - write commands require
access_crmandset_customers; - delete commands require
access_crmanddel_customers.
Commands¶
- MngAddMarketingCampaign
- MngGetMarketingCampaigns
- MngGetMarketingCampaignsByFilter
- MngAddAffiliate
- MngCreateAffiliateReferral — recommended CRM onboarding flow
- MngGetOrCreateAffiliateLink
- MngGetAffiliates
- MngGetAffiliatesByFilter
- MngSetAffiliateBrandAccess
- MngAddMarketingLink
- MngSetMarketingBrandApp
- MngGetMarketingLinks
- MngGetMarketingLinksByFilter
- MngGetMarketingFunnel
- Marketing deletion commands
Attribution flows¶
For browser and external-landing registration, see Customer registration attribution.
For store redirects and first app launch, see Mobile app attribution.
CRM tables should use the ByFilter commands. The older list commands remain
available for compatibility with integrations that load small dictionaries.
Recommended CRM flow¶
The default user journey is:
- Call
MngCreateAffiliateReferralfrom the Add affiliate dialog. - Display and copy the returned
url. - Load the affiliate table through
MngGetAffiliatesByFilter; it includes the primary URL for the effective brand. - For legacy rows without a primary URL, call
MngGetOrCreateAffiliateLinkfrom the Generate link action.
Campaign, manual link, UTM, and sub-ID commands remain available as advanced operations. They are not prerequisites for normal affiliate onboarding.