How to integrate with Amp.ai on the server-side using AmpTokens

Ajay Bhoj

Dec 03, 2018

Introduction

In an earlier post on An Overview of Server-side Integrations with Amp.ai, 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 Amp.ai that are necessary to follow this post, please see Amp.ai 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.

SS-Blog1.002.png#asset:833

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,

SS-Blog1.003.png#asset:834

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:

SS-Blog1.004.png#asset:835

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:

SS-Blog1.005.png#asset:836

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

Summary

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

For more information, contact us here or email us at support@amp.ai. Schedule a demo here