How to copy event parameters as user attributes

For various advanced use cases, you might need to get event parameters reflected as user attributes. Example scenarios like that are:

  • If you need to use the value of the parameter for personalization in Multi-Message Campaigns
  • If you need to segment based on this parameter in triggered Campaigns.

If you have one of those use cases, you might want to transfer the value of a particular event parameter to a user attribute, continuously. This is possible with a simple Campaign using a Webhook action:

Step 1. Create a new campaign. Select any Goal and skip the attribution window setup. Target Audience would be All Users, unless you want to limit the tracking to a particular segment of users only.

Step 2. On the Delivery tab, select triggered and configure the trigger to be the event from which you want to transfer parameters:

1472

Step 3. Depending on your use case, you can store all values of the parameter, the last value only, or both in two separate attributes:

A. If you need to only store the last value of the parameter:
On the Actions tab, add a Webhook action. Configure it as follows:

  • The URL should point to https://api.leanplum.com/api?action=setUserAttributes
  • In the Advanced Options -> Data, add the following fields:
    • appID - your appID from App Settings
    • clientKey - your client key from App Settings
    • userAttributes - the name of the attribute you will store the parameter in, and the name of the parameter as specified in the example
    • userId - the user ID selected through the {{ selector
707

B. If you need to collect all values of the parameter:
On the Actions tab, add a Webhook action. Configure it as follows:

  • The URL should point to https://api.leanplum.com/api?action=setUserAttribute
  • In the Advanced Options -> Data, add the following fields:
    • appID - your appID from App Settings
    • clientKey - your client key from App Settings
    • userAttributeValuesToAdd - the name of the attribute you will store the parameter in, and the name of the parameter as specified in the example
    • userId - the user ID selected through the {{ selector
691

Step 4. Configure the delay of your Webhook to be 0 seconds:

1058

Step 5. Start your Campaign. From that point on, all values of the configured Event Parameter will be copied to the User Attribute.