Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using mixpanel to build custom analytics dashboard for users

I love graphs.

I'd love to get my hands on some data and make it look pretty. But alas, I'm a little lost on what would be considered best practice.

I've selected mixpanel (only as an example) as I seems wonderfully easy to track custom events, and doesn't have any subdomain limitation like Google Analytics.

Say I had 100-1000+ users who have an account (which is publicly facing), and I'm currently tracking the public interactions their pages get. With mixpanel, I can see the data which is lovely, and I've segmented it to individual accounts. So far, so good!

But then, I want to show my users this information. And here my head begins to hurt. Do I schedule a cron jobs, pulling in the data from mixpanel and writing it to their respective accounts? Or is there a better way? I've looked into mixpanel's api (I'm using Ruby), but they keep telling me I should use the javascript api. But in using JS, how does one prevent others getting the data (ie. what's stopping someone faking mixpanel api-posts in the console, or viewing my private key?).

What would you consider a practical solution in such a case?

like image 372
Galaxy Avatar asked Jun 17 '12 00:06

Galaxy


People also ask

How do I add a dashboard on Mixpanel?

Every Mixpanel user has access to Dashboards. Consider starting with your Personal Dashboard (one that only you can see) by adding a few of your favorite reports. All you have to do is go to a report you look at frequently and click the “Add to Dashboards” button in the upper-right corner.

How do I share my dashboard on Mixpanel?

Sharing. Sharing and permissions are set at the dashboard level, and all reports saved on a dashboard inherit the same set of sharing and permissions settings of that dashboard. To share a dashboard, and therefore all reports contained within it, click the Share button at the top right of the dashboard.

What can I use Mixpanel for?

Mixpanel is a tool that allows you to analyze how users interact with your Internet-connected product. It's designed to make teams more efficient by allowing everyone to analyze user data in real-time to identify trends, understand user behavior, and make decisions about your product.

Is Mixpanel a customer data platform?

Mixpanel is an industry-leading product and behavioral analytics platform. It is used by many businesses to optimize their product and increase user engagement. Mixpanel allows you to analyze the customer event data and identify trends associated with your key business metrics.


2 Answers

You can achieve this by storing the user specific events of each user with a $bucket property attached which has a value unique to each user as explained in the mixpanel docs here Mixpanel docs. If you want to still use ruby to serve the events, have a look at Mixpanel's recommended ruby client libraries mixpanel_client looks like the much maintained option of the 2 mentioned. If you go with that then you can serve user specific events as shown in the example below(which is also in the gem's readme):

data = client.request do
  # Available options
  resource  'events/properties'
  event     '["test-event"]'
  name      'hello'
  values    '["uno", "dos"]'
  timezone  '-8'
  type      'general'
  unit      'hour'
  interval   24
  limit      5
  bucket    'contents'
  from_date '2011-08-11'
  to_date   '2011-08-12'
  on        'properties["product_id"]'
  where     '1 in properties["product_id"]'
  buckets   '5'
end
like image 56
dantheta Avatar answered Nov 13 '22 02:11

dantheta


You could try a service like Keen IO that will allow you to generate encrypted scoped write and read API keys. Keen IO is built for customizable and programmatic analytics features such as exposing analytics to your customers, where as MixPanel is more for exploring your data in their UI. The idea with an encrypted scoped key is they will never be able to access your account, only the data you want them to see. You could easily tag your events with a customer ID and then use the Scoped Keys to ensure that you only ever show customers their own data.

https://keen.io/docs/security/#scoped-key

Also, Keen IO has an "importer" which allows you to export your mixpanel events into your Keen IO database.

like image 27
Nick_L Avatar answered Nov 13 '22 04:11

Nick_L