Attentive Tag Cloud Mode Integration

Send events to Attentive Tag using RudderStack cloud mode.

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.

info
The default behavior of identify call is to subscribe a user. To unsubscribe, you can pass identifyOperation as unsubscribe in the integrations object.

Subscribe users

RudderStack maps the following traits to the Attentive properties while subscribing a user:

RudderStack traitAttentive property
traits.email/context.traits.email/properties.email
Required, if phone is not provided.
user.email
traits.phone/context.traits.phone/properties.phone
Required, if email is not provided.
user.phone
integrations.attentive_tag.signUpsourceId
Required, if not specified in the RudderStack dashboard.
signUpSourceId
externalIdexternalIdentifiers
context.traits.customIdentifiers/traits.customIdentifiersexternalIdentifiers.customIdentifiers
info

Note that:

  • The externalIdentifiers property can be an array of objects containing identifiers like clientUserId, shopifyId, klaviyoId.
  • RudderStack prioritizes the signUpSourceId property in the integrations object 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"
  }
});
warning
The externalId fields 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 traitAttentive property
traits.email/context.traits.email/properties.email
Required, if phone is not provided.
email
traits.phone/context.traits.phone/properties.phone
Required, if email is not provided.
phone
integrations.attentive_tag.subscriptionssubscriptions
integrations.attentive_tag.notificationnotification
warning
Passing an email attribute does not locate or unsubscribe a user from SMS subscription. Similarly, passing the phone attribute 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"
  }]
info
You can also provide the language in the notification inside the integrations object to change the notification language. Currently, RudderStack supports only en-US and fr-CA as the notification languages, which are case-sensitive.

Use new Identify flow

info
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.

warning
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_event track call.

Identity API mappings

RudderStack traitAttentive property
traits.email/context.traits.email/properties.emailemail
traits.phone/context.traits.phone/properties.phonephone
context.externalId.[].shopifyIdshopifyId
context.externalId.[].klaviyoIdklaviyoId
context.externalId.[].clientUserIdclientUserId
context.traits.customIdentifiers / traits.customIdentifierscustomIdentifiers

Custom Attributes API mappings

info
RudderStack uses this API to send any traits in the identify call within the properties object of the request.
RudderStack traitAttentive property
traits.email/context.traits.email/properties.emailuser.email
traits.phone / context.traits.phone / properties.phoneuser.phone
context.externalIduser.externalIdentifiers

Track

The track call lets you capture the user actions along with the associated properties.

warning
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 propertyAttentive property
event
Required
type
traits.email/context.traits.email/properties.emailuser.email
traits.phone/context.traits.phone/properties.phoneuser.phone
externalIduser.externalIdentifiers
propertiesproperties
originalTimestamp/timestampoccuredAt
properties.eventIdexternalEventId
context.traits.customIdentifiers/traits.customIdentifiersuser.externalIdentifiers.customIdentifiers
warning

Note that:

  • You must specify the timestamp in the ISO 8601 format.
  • The event type is case-sensitive. For example, Attentive considers Order shipped and Order Shipped as different events.
  • The keys of the properties object 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 /subscriptions endpoint is used for subscribing the user’s email to the email channel.
  • The /subscriptions/unsubscribe is used for unsubscribing phone from the sms channel.

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 signUpSourceId in the track event, as shown.
rudderanalytics.track("subscription_event", {
  "context": {
    "traits": {
      "email": "alex@example.com",
      "phone": "+1-202-555-0146"
    }
  },
  "channelConsents": [{
    "channel": "email",
    "consented": true
  }],
  "signUpSourceId": 123456
});
info
The signUpSourceId field 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 type is not present in the event.
  • If type is 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 eventAttentive event
Product List Viewed
Product Viewed
product-view
Product Addedadd-to-cart
Order Completedpurchase

Product List Viewed

RudderStack maps the Product List Viewed event properties to the following Attentive properties:

RudderStack propertyAttentive Tag property
properties.products.$.product_id
Required
items.productId
properties.products.$.price
Required
items.price.$.value
properties.products.$.variant
Required
items.productVariantId
traits.email/context.traits.email/properties.emailuser.email
traits.phone/context.traits.phone/properties.phoneuser.phone
externalIduser.externalIdentifiers
properties.products.$.currencyitems.price.$.currency
properties.products.$.nameitems.name
properties.products.$.urlitems.productUrl
properties.products.$.image_urlitems.productImage
context.traits.customIdentifiers/traits.customIdentifiersuser.externalIdentifiers.customIdentifiers

Product Viewed/Product Added

RudderStack maps the Product Viewed and Product Added event properties to the following Attentive properties:

RudderStack propertyAttentive property
properties.product_id
Required
items.productId
properties.price
Required
items.price.$.value
properties.variant
Required
items.productVariant.Id
properties.currencyitems.price.$.currency
properties.nameitems.name
properties.urlitems.productUrl
properties.image_urlitems.productImage
traits.email/context.traits.email/properties.emailuser.email
traits.phone/context.traits.phone/properties.phoneuser.phone
externalIduser.externalIdentifiers
context.traits.customIdentifiers/traits.customIdentifiersuser.externalIdentifiers.customIdentifiers

Order Completed

RudderStack maps the Order Completed event properties to the following Attentive properties:

RudderStack propertyAttentive property
properties.products.$.variant
Required
items.productVariantId
properties.products.$.product_id
Required
items.productId
properties.products.$.price
Required
items.price.$.value
properties.products.$.currencyitems.price.$.currency
properties.products.$.nameitems.name
properties.products.$.urlitems.productUrl
properties.products.$.image_urlitems.productImage
traits.email/context.traits.email/properties.emailuser.email
traits.phone/context.traits.phone/properties.phoneuser.phone
externalIduser.externalIdentifiers
context.traits.customIdentifiers/traits.customIdentifiersuser.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"
    }
  ]
});

Questions? Contact us by email or on Slack