Amplitude

Purchasely can send all your transactional events to Amplitude to enrich your users data.

SDK Implementation

To accurately map your Amplitude user ID with your Purchasely user ID, you need to set the appropriate attribute in the Purchasely SDK. You must provide your Amplitude user ID and device ID to Purchasely so that events can be properly associated to your anonymous and connected users.

let amplitudeUserId = Amplitude.instance().getUserId()
Purchasely.setAttribute(.amplitudeUserId, value: String(amplitudeUserId))

let amplitudeDeviceId = Amplitude.instance().getDeviceId()
Purchasely.setAttribute(.amplitudeDeviceId, value: String(amplitudeDeviceId))
Purchasely.setAttribute(
    Attribute.AMPLITUDE_USER_ID,
    Amplitude.getInstance().userId.toString()
)

Purchasely.setAttribute(
    Attribute.AMPLITUDE_DEVICE_ID,
    Amplitude.getInstance().deviceId.toString()
)
Purchasely.setAttribute(Attributes.AMPLITUDE_USER_ID, Amplitude.getInstance().getUserId());
Purchasely.setAttribute(Attributes.AMPLITUDE_DEVICE_ID, Amplitude.getInstance().getDeviceId());
Purchasely.setAttribute(PLYAttribute.amplitudeUserId, Amplitude.getInstance().getUserId());
Purchasely.setAttribute(PLYAttribute.amplitudeDeviceId, Amplitude.getInstance().getDeviceId());
Purchasely.setAttribute(Purchasely.Attribute.AMPLITUDE_USER_ID, Amplitude.getInstance().getUserId());
Purchasely.setAttribute(Purchasely.Attribute.AMPLITUDE_DEVICE_ID, Amplitude.getInstance().getDeviceId());
private PurchaselyRuntime.Purchasely _purchasely;
...
_purchasely.SetAttribute(PLYAttribute.AMPLITUDE_USER_ID, Amplitude.getInstance().getUserId());
_purchasely.SetAttribute(PLYAttribute.AMPLITUDE_DEVICE_ID, Amplitude.getInstance().getDeviceId());

Console configuration

In the Purchasely Console, navigate to the Integrations section and click on Amplitude

  1. Activate the integration
  2. Enter your API Key, that you can get in your Amplitude Console
  3. Select the server location of your Amplitude data

Retrieve your Amplitude API Key

To find your Amplitude project's unique API key and secret key, follow these steps.

  • In the Amplitude Analytics web app, click Settings in the upper right navigation.
  • Click Projects, then find your target project.
  • On the General tab, copy your API key.

Events

Below are the typical Server Events that can be leveraged to create no-code automations

EventDescription
SUBSCRIPTION_STARTEDCan be leveraged to trigger an automation to welcome new subscribers and make them discover the benefits of their premium membership or introduce them with specific premium features
RENEWAL_DISABLEDCan be leveraged to trigger an automation collecting feedback on the cancelation reasons or try to retain premium members before they effectively churn thanks to a retention offer
SUBSCRIPTION_TERMINATEDCan be leveraged to inform users that their premium membership has been effectively terminated
SUBSCRIPTION_RENEWEDCan be leveraged to create an automation thanking users for their loyalty
TRIAL_STARTED/ INTRO_OFFER_STARTEDCan be leveraged to trigger engagement and activation experiences and make premium members discover the benefits and advantages coming along with their subscription
TRIAL_CONVERTEDCan be leveraged to send a message to thank a premium member for their trust after they become a paying member
GRACE_PERIOD_STARTEDCan be leveraged to trigger an automation informing the end user of a billing issue with their premium membership and inviting them to update their credit card to avoid the suspension of their premium benefits