Advertiser Integration
Server-to-Server (S2S) Postback Integration
16 min
overview server to server (s2s) postback integration allows advertisers to send conversion data directly to momentscience from their servers this method provides a reliable way to track conversions without requiring client side implementation on conversion pages when momentscience sends traffic to your landing pages, we include a click id parameter in the url you store this identifier with the user session, then send it back to us via postback when conversions occur key benefits direct server communication without client side dependencies support for multiple conversion events per user session real time conversion tracking with dynamic payout support works with your existing affiliate network integration processes how s2s postback works momentscience sends traffic to your landing page with required parameters your system captures the click id and stores it with the user session user completes an action (purchase, signup, etc ) your server sends a postback to momentscience with conversion details momentscience processes the conversion and attributes it to the correct publisher and offer data requirements mandatory parameters on incoming traffic from momentscience click id unique identifier for tracking this click (required for all postbacks) on your postback to momentscience click id the same identifier you received from incoming traffic optional parameters optional parameters momentscience may send affiliate id unique identifier for the publisher/traffic source this parameter is appended to tracking links to help you attribute traffic and conversions back to the specific publisher additional parameters you can send in postbacks event event type identifier (e g , purchase , signup , lead ) payout \ conversion value for dynamic payout tracking measurement \ must be set to 1 when sending events when tracking events for offers with multiple conversion events, all three parameters ( measurement=1 , event , and payout ) are mandatory and must be included together in the postback url integration steps step 1 capture the click id from incoming traffic when momentscience sends traffic to your landing page, capture the click id parameter from the url and store the click id value with the user's session the method depends on your technology stack example landing page url https //yourdomain com/landing page?click id=abc123xyz456\&offer id=789 step 2 configure your postback url momentscience will provide you with a postback url endpoint store this configuration in your system postback url formats choose the appropriate url format based on your tracking requirements 1\ simple postback (fixed payout, no events) use this url when only one conversion event is available and payout never changes (when the offer doesn't have any event mapped on momentscience's side) simple postback (fixed payout, no events) https //track momentscience com/postback?click id={click id} 2\ advanced postback (multiple events and/or variable payouts) use this url when the offer has one or more events and/or uses variable payouts advanced postback (multiple events and/or variable payouts) https //track momentscience com/postback?measurement=1\&click id={click id}\&event={event}\&payout={payout} when tracking events for offers with multiple conversion events, measurement=1 , event , and payout are all mandatory parameters and must be included together in the postback url parameter type required description click id string yes the unique click identifier received from momentscience event string no event type identifier (e g , purchase , signup , lead ) payout decimal no conversion value in usd (e g , 25 50 ) measurement integer yes must be set to 1 when tracking events replace the placeholder values ( {click id} , {event} , {payout} ) with actual data when sending postbacks step 3 trigger postbacks on conversion events when a user completes a conversion action, send a postback to momentscience with the stored click id single event tracking (no event id) use this approach when tracking a single conversion type without differentiation implementation example // retrieve stored click id const clickid = getfromsession('moment science click id'); if (clickid) { // build postback url const postbackurl = `https //track momentscience com/postback?click id=${clickid}`; // send http get request to momentscience await fetch(postbackurl) then(response => { if (response ok) { console log('conversion tracked successfully'); } }) catch(error => { console error('postback failed ', error); }); } multiple event tracking (with event id and payout) use this approach when tracking multiple conversion types with different values example purchase event https //track momentscience com/postback?click id=abc123xyz456\&event=purchase\&payout=49 99 example signup event https //track momentscience com/postback?click id=abc123xyz456\&event=signup\&payout=5 00 example lead event https //track momentscience com/postback?click id=abc123xyz456\&event=lead\&payout=2 50 implementation example // function to send conversion postback async function sendconversionpostback(clickid, eventtype, payoutamount) { const postbackurl = new url('https //track momentscience com/postback'); // add required parameter postbackurl searchparams append('click id', clickid); // add optional parameters if provided if (eventtype) { postbackurl searchparams append('event', eventtype); } if (payoutamount) { postbackurl searchparams append('payout', payoutamount tofixed(2)); } // send postback request try { const response = await fetch(postbackurl tostring()); if (response ok) { console log(`conversion tracked ${eventtype} $${payoutamount}`); return true; } else { console error('postback failed with status ', response status); return false; } } catch (error) { console error('postback request failed ', error); return false; } } // usage example track a purchase conversion const clickid = getfromsession('moment science click id'); if (clickid) { await sendconversionpostback(clickid, 'purchase', 49 99); } step 4 handle multiple conversions per user momentscience supports tracking multiple conversion events for a single user session this is useful for multi step funnels track signup, then track purchase recurring actions track multiple purchases over time different event types track various user actions with different payouts time window considerations conversions can be tracked from the initial click up to 30 days (default) all conversions within the window will be attributed to the original click id postback response codes momentscience returns http status codes to indicate the result of your postback request status code meaning action required 200 ok conversion successfully recorded no action needed do not resend any other status request failed or error occurred retry the request with exponential backoff only retry postbacks that receive a non 200 status code if you receive a 200 ok response, the conversion has been recorded successfully and should not be sent again if you encounter any issues during integration or have questions about s2s postback tracking, contact us help\@momentscience com