arrow-left arrow-right brightness-2 chevron-left chevron-right circle-half-full facebook-box facebook loader magnify menu-down rss-box star twitter-box twitter white-balance-sunny window-close
Day 7: Reporting on visitor sources
5 min read

Day 7: Reporting on visitor sources

We now have the code (lambdas) to tell segment about the first and last visitor source (twitter, facebook, ads,…). Let’s do something useful with this.

Today I will focus on the following two tasks

  1. Make sure all profiles have the updated information
  2. Create some reports to solve some of the problems originally set out to solve

Trigger the segment calls

I am not fully confident yet around the properties (naming, data) and events (data, timestamp) I am sending to all integrations. That’s why the functions are not generating segment events in real-time just yet. They have to be manually triggered.

The trigger itself is super easy:

  • Open a browser tab
  • $lambda_endpoint/prod/segment/track/{user_id}.

As I can not query my userbase from segment (don’t have access to personas), nor do I have all the user traits for identify() payload in DynamoDB I need to discover an elegant way to trigger the calls for the right users: Mixpanel and/or Customer.io to the rescue as they both have a user directory since I’ve been sending them our data for a few years.

Mixpanel

Every time I use Mixpanel I am so impressed with the power of this platform. We could not live without it for Product Usage Analytics but I’d say that it’s underused in our marketing efforts.

There is this nice messages feature allowing you to trigger webhooks for users that match certain criteria.

Trigger a webhook for Users without the right traits

Sounds good so let's discover if it can be done:

Mixpanel supports a POST webhook for campaigns like this we need to come up with a specific endpoint that supports the mixpanel implementation and then fires the other lambda’s for every user posted. Not impossible but 🥴

Writing the first code for this I discovered that mixpanel is sending a POST payload with their internal userIds (distinct_id) but did not post my internal userIds (external_id). To translate mixpanel id into the userId required to trigger the Lambda I needed to talk to their API 😱

Let’s see if there is another way to do this.

Customer.IO

We’ve been with Customer.IO since 2014 and it’s frigging awesome! So much power under the hood, really good integration with segment (both as source and destination) and with their workflow builder you can do super powerful stuff.

Let’s see if Customer.IO can trigger those Lambdas for us.

First I will start with creating some visitor segments of visitors that are missing the user traits and/or Source Identified events:

Some segments created in Customer.io

Segments can be built from User Properties, Event Occurance and you can even filter by event properties or when events occurred. Here is an example of the segment for everyone that has no source events tracked:

SMA — No Source Events segment

So it’s super easy to identify who we need to trigger the lambdas for. Now let's try to trigger them by creating a campaign:

Campaign Criteria

The workflow builder allows you add steps such as sending a text message, firing a twilio call, send an email or trigger a webhook. Just what we need.

Lets go to the visual workflow builder and set up two workflow items that call our webhook

Trigger lambda functions from the visual workflow builder

So what this will do is trigger both lambda functions for all the users that don’t have the traits or events yet.

The webhook configuration is very easy:

GET request to lambda function

After setting this workflow live I saw a few hundred calls to our Lambda functions.

Amazon Bill

After 6 days with +10 mio historic records and the deployed version of our event ingestion webhook these are the costs in AWS:

Add some data transfer costs, some S3 costs we’re looking at less than 2$ for the entire experiment.

Useful Attribution Reports

Let’s see what we can do with this data. For reporting I really enjoy using Mixpanel and in the below screenshots/reports I will try to show the power of Mixpanel Funnels, Insights with the new data:

In insights I can now see which are the main traffic sources for visitors that look at the pricing page.

Cohort = Visited Pricing. Where do users come from?

Not too shabby. Not too exciting either. Reports like this are super easy in Google Analytics so let’s take it one step further.

Let’s see if we can use the new user traits to break down our funnels by incoming source type (paid, social, referrer…)

Funnel broken down by first_source

So here you can see the funnel:

visit website → consider demo → booking a demo

But split up by the first referral type where you can see that referral traffic has a much higher total conversion rate.

I was hoping I could show you some exciting attribution reports at this stage but the big thing missing in the attribution puzzle is sales data.

We (@Prezly) are using Hubspot. So in the next days I will be discovering how I can feed important Hubspot data back to my segment tracking scheme.

See you tomorrow!