Attentive Tag Cloud Mode Integration
6 minute read
After you have successfully set up Attentive Tag as a destination in RudderStack, follow this guide to correctly send your events to Attentive Tag in cloud mode.
Find the open source transformer code for this destination in the GitHub repository.
Identify
You can subscribe or unsubscribe a user from an Attentive list using the identify call.
The default behavior ofidentifycall is to subscribe a user. To unsubscribe, you can passidentifyOperationasunsubscribein theintegrationsobject.
Subscribe users
RudderStack maps the following traits to the Attentive properties while subscribing a user:
| RudderStack trait | Attentive property |
|---|---|
traits.email/context.traits.email/properties.emailRequired, if phone is not provided. | user.email |
traits.phone/context.traits.phone/properties.phoneRequired, if email is not provided. | user.phone |
integrations.attentive_tag.signUpsourceIdRequired, if not specified in the RudderStack dashboard. | signUpSourceId |
externalId | externalIdentifiers |
context.traits.customIdentifiers/traits.customIdentifiers | externalIdentifiers.customIdentifiers |
Note that:
- The
externalIdentifiersproperty can be an array of objects containing identifiers likeclientUserId,shopifyId,klaviyoId.- RudderStack prioritizes the
signUpSourceIdproperty in theintegrationsobject over the value specified in the Sign Up Source ID dashboard setting.
A sample identify call to subscribe a user is as follows:
rudderanalytics.identify("jbu3471", {
"email": "alex@example.com",
"phone": "+1-202-555-0146",
"customIdentifiers": [{
"name": "string",
"value": "string"
}]
}, {
"externalId": [{
"type": "clientUserId",
"id": "144"
},
{
"type": "shopifyId",
"id": "224"
},
{
"type": "klaviyoId",
"id": "132"
}
],
"integrations": {
"signUpSourceId": "347393"
}
});TheexternalIdfields are case-sensitive. Also, RudderStack expects them to be in the above format for mapping them correctly.
Unsubscribe users
You can set identifyOperation to unsubscribe in the integrations object to unsubscribe a user:
rudderanalytics.identify("jbu3471", {
"email": "alex@example.com",
"phone": "+1-202-555-0146",
}, {
"integrations": {
"attentive_tag": {
"identifyOperation": "unsubscribe",
},
"subscriptions": [{
"type": "MARKETING",
"channel": "TEXT"
}],
"notification": {
"language": "en-US"
}
}
});RudderStack maps the following traits to the Attentive properties while unsubscribing a user:
| RudderStack trait | Attentive property |
|---|---|
traits.email/context.traits.email/properties.emailRequired, if phone is not provided. | email |
traits.phone/context.traits.phone/properties.phoneRequired, if email is not provided. | phone |
integrations.attentive_tag.subscriptions | subscriptions |
integrations.attentive_tag.notification | notification |
Passing anphoneattribute does not locate or unsubscribe a user from email subscription.
You can also unsubscribe a user from a channel by specifying it in subscriptions within the integrations object. The supported values for subscriptions are:
"subscriptions": [{
"type": "MARKETING" || "TRANSACTIONAL" || "CHECKOUT_ABANDONED"
"channel": "TEXT" || "EMAIL"
}]You can also provide thelanguagein thenotificationinside theintegrationsobject to change the notification language. Currently, RudderStack supports onlyen-USandfr-CAas the notification languages, which are case-sensitive.
Use new Identify flow
This feature is currently in beta.
The new Identify flow leverages the following Attentive APIs:
- Identity API: To associate a client user identifier or custom identifier(s) with other identifiers.
- Custom Attributes API: For updating the user attributes or properties.
To use the new Identify flow, turn on the Enable new Identify flow setting during the destination setup.
Your API key must have the necessary permissions to use the new Identify flow. Contact your Attentive representative for steps on enabling these permissions.
Note that:
- If you toggle off this setting, RudderStack uses the default subscription / unsubscription flows instead.
- In this flow, RudderStack does not make any user subscription or unsubscription API calls — to do so, you will need to use the
subscription_eventtrackcall.
Identity API mappings
| RudderStack trait | Attentive property |
|---|---|
traits.email/context.traits.email/properties.email | email |
traits.phone/context.traits.phone/properties.phone | phone |
context.externalId.[].shopifyId | shopifyId |
context.externalId.[].klaviyoId | klaviyoId |
context.externalId.[].clientUserId | clientUserId |
context.traits.customIdentifiers / traits.customIdentifiers | customIdentifiers |
Custom Attributes API mappings
RudderStack uses this API to send any traits in theidentifycall within thepropertiesobject of the request.
| RudderStack trait | Attentive property |
|---|---|
traits.email/context.traits.email/properties.email | user.email |
traits.phone / context.traits.phone / properties.phone | user.phone |
context.externalId | user.externalIdentifiers |
Track
The track call lets you capture the user actions along with the associated properties.
RudderStack does not trigger an event if the timestamp is older than 12 hours.
Property mapping
RudderStack maps the following track call properties to the Attentive properties:
| RudderStack property | Attentive property |
|---|---|
eventRequired | type |
traits.email/context.traits.email/properties.email | user.email |
traits.phone/context.traits.phone/properties.phone | user.phone |
externalId | user.externalIdentifiers |
properties | properties |
originalTimestamp/timestamp | occuredAt |
properties.eventId | externalEventId |
context.traits.customIdentifiers/traits.customIdentifiers | user.externalIdentifiers.customIdentifiers |
Note that:
- You must specify the timestamp in the ISO 8601 format.
- The event type is case-sensitive. For example, Attentive considers
Order shippedandOrder Shippedas different events.- The keys of the
propertiesobject should not contain characters, like [',",{,},[,], \ ,,]
Subscription events
You can perform user subscription and unsubscription operations using the subscription_event track call.
A sample subscription_event is shown below:
rudderanalytics.track("subscription_event", {
"context": {
"traits": {
"email": "alex@example.com",
"phone": "+1-202-555-0146"
}
},
"channelConsents": [{
"channel": "email",
"consented": true
},
{
"channel": "sms",
"consented": false,
// "type": "MARKETING" (Unsubscribes the user from this subscription type)
}
],
// To specify the Signup Source ID in the track event instead of destination setting
// "signUpSourceId": 123456
// For unsubscribe case:
// Optional notification properties to override
"notification": {
"language": "en-US",
"disable": true
}
});The above event results in the following POST calls:
- The
/subscriptionsendpoint is used for subscribing the user’semailto theemailchannel. - The
/subscriptions/unsubscribeis used for unsubscribingphonefrom thesmschannel.
For subscribing to both email and sms channels, you can send the channel consents as shown below:
"channelConsents": [{
"channel": "email",
"consented": true
},
{
"channel": "sms",
"consented": true,
}
]Considerations
This section highlights some key considerations for the subscription and unsubscription operations.
For subscription
- Signup Source ID is required for the subscription operation. You can also provide the
signUpSourceIdin thetrackevent, as shown.
rudderanalytics.track("subscription_event", {
"context": {
"traits": {
"email": "alex@example.com",
"phone": "+1-202-555-0146"
}
},
"channelConsents": [{
"channel": "email",
"consented": true
}],
"signUpSourceId": 123456
});ThesignUpSourceIdfield in the event payload overrides the Signup Source ID specified in the destination settings.
For unsubscription
- The user is removed from all subscriptions if subscription
typeis not present in the event. - If
typeis provided, the user is removed from the specified subscription type or channel combination. An example is shown below:
rudderanalytics.track("subscription_event", {
"context": {
"traits": {
"email": "alex@example.com",
"phone": "+1-202-555-0146"
}
},
"channelConsents": [{
"channel": "sms",
"consented": false,
"type": "MARKETING" // Unsubscribes the user from this subscription type
}]
});Ecommerce events
RudderStack converts the following ecommerce events to the corresponding Attentive events:
| RudderStack event | Attentive event |
|---|---|
| Product List Viewed Product Viewed | product-view |
| Product Added | add-to-cart |
| Order Completed | purchase |
Product List Viewed
RudderStack maps the Product List Viewed event properties to the following Attentive properties:
| RudderStack property | Attentive Tag property |
|---|---|
properties.products.$.product_idRequired | items.productId |
properties.products.$.priceRequired | items.price.$.value |
properties.products.$.variantRequired | items.productVariantId |
traits.email/context.traits.email/properties.email | user.email |
traits.phone/context.traits.phone/properties.phone | user.phone |
externalId | user.externalIdentifiers |
properties.products.$.currency | items.price.$.currency |
properties.products.$.name | items.name |
properties.products.$.url | items.productUrl |
properties.products.$.image_url | items.productImage |
context.traits.customIdentifiers/traits.customIdentifiers | user.externalIdentifiers.customIdentifiers |
Product Viewed/Product Added
RudderStack maps the Product Viewed and Product Added event properties to the following Attentive properties:
| RudderStack property | Attentive property |
|---|---|
properties.product_idRequired | items.productId |
properties.priceRequired | items.price.$.value |
properties.variantRequired | items.productVariant.Id |
properties.currency | items.price.$.currency |
properties.name | items.name |
properties.url | items.productUrl |
properties.image_url | items.productImage |
traits.email/context.traits.email/properties.email | user.email |
traits.phone/context.traits.phone/properties.phone | user.phone |
externalId | user.externalIdentifiers |
context.traits.customIdentifiers/traits.customIdentifiers | user.externalIdentifiers.customIdentifiers |
Order Completed
RudderStack maps the Order Completed event properties to the following Attentive properties:
| RudderStack property | Attentive property |
|---|---|
properties.products.$.variantRequired | items.productVariantId |
properties.products.$.product_idRequired | items.productId |
properties.products.$.priceRequired | items.price.$.value |
properties.products.$.currency | items.price.$.currency |
properties.products.$.name | items.name |
properties.products.$.url | items.productUrl |
properties.products.$.image_url | items.productImage |
traits.email/context.traits.email/properties.email | user.email |
traits.phone/context.traits.phone/properties.phone | user.phone |
externalId | user.externalIdentifiers |
context.traits.customIdentifiers/traits.customIdentifiers | user.externalIdentifiers.customIdentifiers |
The following snippet highlights a sample track call for the above ecommerce event parameters:
rudderanalytics.track("Order Completed", {
"products": [{
"product_id": "507f1f77bcf86cd799439011",
"name": "MOBILE",
"variant": "green",
"price": "19",
"image_url": "image.com",
"url": "url.com",
"quantity": "2",
"currency": "USD"
}]
}, {
"traits": {
"email": "alex@example.com",
"phone": "+1-202-555-0146"
},
"externalId": [{
"type": "clientUserId",
"id": "144"
},
{
"type": "shopifyId",
"id": "224"
},
{
"type": "klaviyoId",
"id": "132"
}
]
});