Using event data with mParticle
mParticle allows you to capture event data and use an event output to send the data to Talon.One in close to real time.
For example, if customers click a button on your website, you can collect the event data using mParticle, and forward it to Talon.One.
Then, in Talon.One, you can create coupon codes to offer everyone who clicked the button a discount for their next purchase.
In this tutorial, we assume you are using mParticle's original UI. To enable it, sign in to mParticle and click Settings > Go to Classic Experience.
Talon.One requirements
- You are an Admin user.
- You have an Application set up.
- Your Application contains a running campaign with the Coupons feature enabled.
- You have created an mParticle-specific API key.
mParticle requirements
- You are an Admin user.
Creating the feed input
Feed inputs allow you to send data to mParticle. In this tutorial, we'll use a custom feed input to send the click event data from your website to mParticle.
You can also use a Talon.One feed input for this. However, because we're not sending data from Talon.One, a custom feed is more appropriate.
To create the feed input:
- In mParticle, open Setup > Inputs and switch to the Feeds page.
- If there's a Custom Feed section with existing feeds, open it and click +. Otherwise, click Add Feed Input and select Custom Feed.
- In the Input: Feed Configuration window, configure the following parameters:
- Configuration Name: Type a configuration name.
- Feed Status: Select Active.
- Input Protection Level: Select Create & Update Profiles.
- Click Save.
- Save the Server to Server Key and Server to Server Secret values for later use. We'll need them for testing.
Creating the event output
With an event output, you can send data from mParticle to Talon.One. In this tutorial, we'll use an event output to forward the click event data.
To create the event output:
- In mParticle, open Setup > Outputs.
- If there's a Talon.One Default Group section with existing outputs, open it and click +. Otherwise, click Add Event Output and select Talon.One.
- In the Output: Event Configuration window, configure the following parameters:
- Configuration Name: Type a configuration name.
- Use same settings for Development & Production: Select this option.
- API Key: Paste the API key you created.
- Deployment URL: Type the base URL of your Talon.One deployment, for example,
mycompany.europe-west1.talon.one
. - User ID: Select the user identity to map with Talon.One as the customer's user ID. In this tutorial, we'll use Customer ID.
- Run Rule Engine: Select this option.
- Click Save.
Creating the connection
Now that we have created an input and an output, let's connect them, so that the click event data flows from your website via mParticle to Talon.One.
To create the connection:
- In mParticle, open Connections > Connect.
- Click the custom feed input you created.
- Click Connect Output.
- In the Connect Output window, select the event output you created.
- Set Connection Status to Active.
- Click Add Connection.
Enabling data forwarding
After creating the connection, mParticle's Data Filter feature may prevent data from being forwarded.
To enable data forwarding:
- In mParticle, open Connections > Feed Filters.
- At the top of the page, select the feed input you created.
- Select the Send new data points by default checkbox.
- Enable all data points:
- On the Events page, in the Events Data Type Filter section, click ... > Turn ON all data points.
- On the Users page, in the Users Data Type Filter section, click ... > Turn ON all data points.
- Click Save.
It takes a few minutes for the changes to take effect.
Building the rule in Talon.One
To act on events sent via mParticle, create a rule in your Talon.One campaign with the following logic:
What | Name | Properties |
---|---|---|
Conditions | Check for event types and custom event values |
|
Effects | Create coupon code | Set your desired coupon settings. |
When Talon.One receives an event with the given name, the rule is triggered, and a coupon code is created.
Testing the connection
Let's test our setup using the Events API provided by mParticle.
To test the connection:
-
Use curl or a similar tool to send the following request, where:
FEED_INPUT_KEY
andFEED_INPUT_SECRET
are the key and secret values of the feed input you created.YOUR_CUSTOMER_ID
is a customer ID of your choice, for example,John Doe
.
curl --location 'https://s2s.mparticle.com/v2/events' --user 'FEED_INPUT_KEY:FEED_INPUT_SECRET' --header 'Content-Type: application/json' --data '{
"schema_version": 2,
"environment": "development",
"user_identities": {
"customer_id": "YOUR_CUSTOMER_ID"
},
"events": [
{
"data": {
"event_name": "click_event",
"custom_event_type": "other"
},
"event_type": "custom_event"
}
]
}'noteThis request is for testing purposes only. You should customize it for your actual setup.
-
In mParticle, open Data Master > Live Stream and check whether mParticle has received the request.
-
In Live Stream, set Message Direction to Outbound and check whether mParticle has forwarded the request.
-
In Talon.One:
- Open your Application, click Events, and check whether an
mparticle_event
event has been received. - Open your campaign, click Coupons, and check whether a coupon has been generated for the given customer ID.
- Open your Application, click Events, and check whether an
Troubleshooting
When you build a rule, if the mparticle_event
event type does not yet exist, send the following test request to Talon.One, where:
YOUR_API_KEY
is the API key you created.YOUR_DEPLOYMENT_URL
is the base URL of your Talon.One deployment.
curl --location 'https://integration.talon.one/mparticle' --header 'Content-Type: application/json' --data '{
"type": "event_processing_request",
"account": {
"account_settings": {
"apiKey": "YOUR_API_KEY",
"deploymentURL": "YOUR_DEPLOYMENT_URL",
"userIdField": "mpid"
}
},
"events": [
{
"type": "custom_event",
"name": "test_event"
}
],
"mpid": "12345"
}'