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
- Activate the integration
- Enter your API Key, that you can get in your Amplitude Console
- Select the server location of your Amplitude data
![](https://files.readme.io/a5a352d-SCR-20240717-plrg.png)
![](https://files.readme.io/5686308-SCR-20240717-plyz.png)
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.
![](https://files.readme.io/53b91c5-image.png)
Events
![](https://files.readme.io/814f3da-SCR-20240717-pmjp.png)
Below are the typical Server Events that can be leveraged to create no-code automations
Event | Description |
---|---|
SUBSCRIPTION_STARTED | Can 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_DISABLED | Can 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_TERMINATED | Can be leveraged to inform users that their premium membership has been effectively terminated |
SUBSCRIPTION_RENEWED | Can be leveraged to create an automation thanking users for their loyalty |
TRIAL_STARTED / INTRO_OFFER_STARTED | Can be leveraged to trigger engagement and activation experiences and make premium members discover the benefits and advantages coming along with their subscription |
TRIAL_CONVERTED | Can be leveraged to send a message to thank a premium member for their trust after they become a paying member |
GRACE_PERIOD_STARTED | Can 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 |
Updated about 1 month ago
What’s Next