How to integrate with on the server-side using AmpTokens

Ajay Bhoj

Dec 03, 2018



In an earlier post on An Overview of Server-side Integrations with, we discussed high-level concepts related to server-side integrations. In this post, we'll discuss an integration example using AmpTokens. For a quick introduction to the key concepts in that are necessary to follow this post, please see vs A/B Testing: A paradigm shift.

AmpTokens are tokens that encapsulate meta-data about sessions, making it possible to manage sessions in your application automatically. They ensure that:

Example use-case: Campaign optimization

Let us dive deeper into server-side integrations with an example use-case: web campaign optimization. The session composition is shown below.


In this example, each visit to the campaign website is either a new session or resumes an earlier one (i.e. if the user returns within a time period referred to as the session lifetime). The objective of the campaign is to increase the chances that visitors will donate money. Additional metrics could include total amount donated. Variations of the slogan, along with the variant identifier are shown below,


A sample architecture diagram describing the integration is shown below, where requests flow from the browser to the backend system and back to the browser:


Some observations:

With AmpTokens, no matter which micro-service is involved, the integration code snippet looks symmetrical (i.e. extract AmpToken, observe/decide, forward AmpToken) as shown below:


Here, the outcome event "Donated" is sent to the backend directly from the browser. Post integration and deployment, sessions are tracked continuously and show up in the console


In this post, we explored an example server-side integration with, using AmpToken based sessions. The key points to remember when working with AmpTokens are:

For more information, contact us here or email us at Schedule a demo here