Rittman Analytics

View Original

Tracking Customer Email Marketing Interactions using Segment Personas and Connections

Rittman Analytics is a Segment Implementation Partner and we use Segment’s Connections customer data infrastructure service to capture all of our customer and prospect interactions across all digital channels, feeding that data into our marketing and customer SaaS applications and the event-level customer behavioral data warehouse we’ve built using Google BigQuery.

Screenshot 2019-12-15 at 13.13.33.png

In addition to this customer data warehouse we’ve also implemented a customer data platform (CDP) using Segment Personas, complementing the warehouse and providing us with a platform for cross-device identity resolution, user profiling and audience (segmentation) creation for our marketing campaigns and client communications.

At a high-level our Segment Personas CDP leverages Segment Connections to capture customer and visitor interaction data from a number of different sources, with Connections feeding those interactions into our downstream CRM and other systems and Personas sitting in the middle as the customer data platform also sending computed and user-level traits to those downstream services, for example the lead score that we blogged about in an earlier post.

Screenshot 2019-12-15 at 09.50.13.png

Website interactions across both rittmananalytics.com and drilltodetail.rittmananalytics.com are captured as page views and track events using Segment’s Javascript tracker as described in our previous post on Using Segment Personas for Lead Scoring at Rittman Analytics. For tracking interactions with the marketing campaign emails we send out using Mailchimp, our email service provider, there are four types of event we want to capture and have available to us in our customer data platform:

  1. Email sends, when a mailing list email gets sent to a contact as part of a Mailchimp campaign

  2. Email opens, when a subscriber opens the campaign email and reads all or part of it

  3. Email clicks, when a subscriber clicks on one of the URL links in a campaign email

  4. Email responses, when a subscriber replies to the campaign email

Segment has Mailchimp along with several other email marketing platforms available as Cloud App Sources within Segment Connections and it’s what’s termed a Cloud Object Source; these types of sources are analogous to using services such as Stitch and Fivetran and replicate data in this case from Mailchimp’s API into a target data warehouse, in our case Google BigQuery. Segment’s Mailchimp Cloud Object Source brings across details of campaigns and lists (audiences) and whilst this is useful it doesn’t include details of who we actually sent those emails to (for this information we also use Stitch, separately to Segment, that brings across full details of who belonged to each audience, what they were sent and at what time).

Crucially though, neither Segment’s Mailchimp Cloud Object Source or Stitch’s integration create Segment track or identify events that can be recorded alongside other interaction events in a users’ profile in Segment Personas; we can use Personas' SQL Traits feature to query the target warehouse to count the number of email sends if we’d use Stitch to bring these through but they wouldn’t show up as individual events in a user’s event timeline. To capture email clicks, email opens and email replies we therefore used Segment’s Pixel API, Javascript API and HTTP API to capture these events in real-time via parameters we pass in image and link URLs and Gmail events we capture using Zapier.

Screenshot 2019-12-15 at 10.21.46.png

Setting up email open tracking with the Pixel API involves first crafting an HTML img element where the location of the image file is Segment’s servers with a set of parameters included that provide your Pixel API write key and details of the event you want the email opening to trigger (track, identify, screen etc). The docs imply that you can only pass these parameters as base64-encoded which would be tricky when using a service such as Mailchimp that does support URL but not base64-encoding at least within their web email authoring UI, but you can actually just use your write key and other parameters in plain text for the Pixel API URL call like this:

https://api.segment.io/v1/pixel/

<

METHOD

ENDPOINT

>

?data=

<

base64-ENCODED-JSON

>

{"writeKey": "Uuel9igVwbCyM7y7TlT1sIQBs7Sli6hQ","userId": "025pikachu025","event": "Email Opened json","properties": {"subject": "The Electric Daily","email": "peekAtMe@email.poke"}}https://api.segment.io/v1/pixel/track?writeKey=Uuel9igVwbCyM7y7TlT1sIQBs7Sli6hQ

&userId

=025pikachu025

&event

=EmailOpened

&properties.subject

=The Electric Daily

&traits.name

=Brantley Beaird

Then you include a reference to this img URL in the email you send out to subscribers in your campaign, and when they then open your email it registers in our case a tracking event in Segment Connections that’s then recorded in the user’s profile in Personas.

Screenshot 2019-12-15 at 11.27.59.png

Capturing clicks on links in our campaign email is something we’ll do using the regular Segment Javascript tracker by passing details of the event(s) we want to capture in the link URL parameters, using the Javascript tracker’s querystring API. Note that you can pass both an identify event and a track event in the same querystring, useful if an email click is the first interaction your user has with Segment and you also want to log the email click as an event against that new user.

Screenshot 2019-12-15 at 12.32.47.png

Finally, to complete the feedback loop we use Zapier and Segment’s HTTP API to capture all incoming emails to our info@rittmananalytics.com and other key email destinations and use that service to lookup the Hubspot contact IDs for the sender or recipient email address depending on who we want to track, and then send that this information to Segment Connections as a track event using Segment’s HTTP API.

Screenshot 2019-12-15 at 12.44.38.png

We can then see all of these events alongside other interactions each mailing list subscriber has made across all our other digital channels in their Personas event journey and user profile.

Screenshot 2019-12-15 at 13.08.51.png

You can read more about our partnership with Segment here, or schedule a call with us now if you’re interested in building-out a customer data platform or using Segment Personas for this type of scenario.