Skip to main content
A sponsor’s ad campaign can lead to a draw on your site: the creative clicks through to a page where a signed-in fan enters to win something the sponsor offers. When the fan enters, your backend reports the entry to 4D. 4D stores one entry per fan and campaign, counts it in the sponsor’s campaign stats, and can pay the fan XP for it from the sponsor’s own pool.

Report an entry

Call it from your server with an organization org_ key and the fan’s id in your own system. Never call it from a browser or with a publishable key.
status is one of three outcomes, all answered 200: Only a fan who holds the consent is deduplicated. An entry from a fan without it is stored anonymously and counted on every call, so a retry, a second device or a later entry by the same fan each add one to the campaign’s entries. Retrying a call for a fan who holds the consent is always safe. For a fan without it, a retry after an answer you never received can count the same entry twice. The consent is the tenant consent item titled “Personalised content”, scope org.<your organization id>.personalised-content. Errors:

XP for an entry

xp is funded when the sponsor’s XP pool pays this entry, and none otherwise. Three things have to hold:
  1. The ad campaign is linked to the sponsor’s XP campaign (its pool). Set the link on the ad campaign as xp_campaign_id.
  2. An earning rule pays an entry on this campaign from that pool. An entry arrives as the earning event engagement.content.viewed with content_type ad_campaign_entry and content_id ad_campaign_entry:<ad campaign id>, so the rule is a case on Content viewed whose condition is content_id equal to that value, funded by the sponsor’s campaign. A case that matches is paid instead of the key’s default, so your ordinary content-view award never pays an entry. Only 4D produces that content id: an event from one of your modules carrying it, or carrying the ad_campaign_entry content type, is refused at /v1/ingest with reserved_ad_entry_marker, so no content view your site sends can be paid from the sponsor’s pool.
  3. The pool is active, inside its dates, and holds at least the award.
When any of these does not hold the entry is still recorded, with xp none, and nothing is paid from your own reserve. The award is paid asynchronously, through the same path as every other XP award: your earning controls apply and the fan’s balance moves a moment later. The response never carries an amount, and a funded entry can still earn nothing if a control refuses it, such as a member’s daily cap. Because an entry is a Content viewed event, any daily or lifetime limit you set on content views counts entries too: a fan who has used up their content-view limit for the day can enter with xp funded and earn nothing for it. See XP for sponsor-funded campaigns.

What the sponsor sees

The sponsor’s campaign stats count entries, anonymous ones included, and the number of fans who engaged with the campaign. They never show a fan’s name or id.