Tools to track customers data

What are these tools and what do they do?

Recently I got a chance to work with different tools to track the customers data on your web app. I decided to use Intercom and Mixpanel.  Both these tools allow you to track customers activity in the form of an ‘event‘.

Events are basically activity a user does on your web app. It could be as simple as clicking the sign up button. Or filling the sign up form and clicking submit. This could be 2 different events.

But you would wonder why use 2 tools for tracking the same data? Well mix panel is purely an analytics tool. But intercom does more than that. It also provides the in-app messenger,  a chatbot if you will. Also one can trigger behaviour based on events. For ex: a ‘sign up’ event is triggered and we need to send account activation link upon every successful sign up. Now instead of configuring mailers in our rails app, we can just define behaviour in intercom to do some action whenever sign up occurs. And this behaviour could be sending emails or sending messages to the chat box. So I would say that primary purpose of intercom is to add messenger and add behaviour on events rather than doing analytics on those event data. Mix panel would be a better tool for this.

Why we need these tools?

But you would wonder how does this data help? Well, it gives you insight about how does the user uses your app. Considering the same example, by tracking those 2 different events, you would have knowledge that ‘n’ users visited the sign up page, but only ‘n/3’ signed up.

So now you can add events to more granular level i.e by adding events to every field. This will give you insight about which is that field which users hesitates to enter the information about. And so on and so forth and thus can look to change things with user behaviour in mind rather than guessing about it.

How to use these tools?

I wanted to integrate these tools with an rails application. Now the general way to use any 3rd party tool is to generate the api key/token , secret key by registering on the dashboard if these tools. And there are usually ruby gems / javascript existing for these tools to integrate with our application.

And it is exactly what you need to do. Lets look at both of these tools one at a time.

Intercom basically provides you 3 products. Intercom acquire, Intercom Engage and Intercom Resolve. The first 2 are of interest to me. Intercom acquire allows you to add messenger. Intercom engage allows you to add behaviour based on occurrence of events.

Now if you just want to add the chat box to your app, you can just use this gem intercom-rails.  The usage is pretty straightforward. Generate an app id through intercom dashboard. Use the gem to generate the config file for intercom. And use the generated app_id in the intercom config file. As I needed the messenger on just the production site, so I enabled it only for it

config.enabled_environments = ["production"]

and I wanted to record some custom data of the tracker users. Ex:

config.user.custom_data = {
  id: :id,
  user_name: :email,
  companies: Proc.new do |company|
    company.sites.map do |site|
    {
      id: site.id,
      name: site.name
    }
    end
end
}

Now what intercom does is whenever a user logs into your application, it sends this custom data about logged in user to the intercom just by using the custom_data defined in the initialisers file. If does not matter if the user logs in for the first time or 100th time.

Now stop here if you only wish to add the messenger, but if you are looking to track events and add behaviour based on those events, read on.

To add events, there is another ruby gem which you need to use and it is called intercom-ruby. This gem also lets you register users, add tags, send messenger apps. But then intercom-rails lets you register users to intercom. So we don’t really need to use intercom-ruby to send users data.

The documentation is pretty neat. So I will not repeat what is already mentioned there. You can read it here. But server side is not the only way to track data. There is also the javascript way of doing it. You can read about it here. I decided to do this with ruby as of now as it looked more neat.

Now follow these pictures to see how to setup behaviour based on events or filters:

Step 1: Open the Intercom engage dashboard

1

Now you can set up message name as an identifier for behaviour.

Step 2: Choose your audience

2

So there are various criteria available to choose from. You can setup any rule you want to filter your audience with. Also if you scroll down the list of user data, at the bottom of that list, you will find filtering based on events names.

3

As you can see there is an event name ‘Signed Up’. So whenever user signs up, this behaviour will happen, it could be send the user an welcome link in an email or send him an welcome message on his intercom messenger.

4

 

and you can create your message.

Now lets move onto mix panel.

The ruby gem which could be used for mix panel is mixpanel-ruby. Again you read the documentation about how to use the gem or read on the official website here.

Now if you have been following so far, you would have realised thats its a lot of code that you would need to write(ruby or javascript) to track events in multiple platform. So to avoid this hassle, there is another tool called Segment.

Segment allows you to send your customer data to just one platform i.e theirs and they take of the rest. They send the same data to intercom and mix panel and various other platforms they can be integrated with.

Now to use segment, there is a ruby library as well as javascript library as there are always. Looking at the documentation I realised the javascript library usage is also pretty neat and could be used easily. So we would be using that.

So to use it like any other js library, you need to include the segment script in web page head. And then there are couple of things you could do. You can either identify user which means let segment know which user is doing the event and send the event. Or you can directly send the event by calling track without any call to identify function.

Also for events which occur internally and does not really have a web page to show it for so that javascript can run, I ended up using the ruby library.

So, all you have to do is integrate just segment and it takes care of sending this data to all other platform of interest to you.

I hope it helps some of you.

Happy tracking.. !!!!

Advertisements