Background

At honestbee, our BI (Business Intelligence) team uses Looker for analyzing data and to build engaging dashboards on top of that. Looker has proved to be a great asset for us since it allows our BI team to be independent of Engineering team. It helps our business teams drive decisions based on the data reports generated by Looker

In all our different verticals (groceries, food & goodship - our B2B parcel business) we work closely with merchant partners. Earlier this year, we started working on a portal that allows our merchant partners to see how their business is performing on honestbee. To do this, we had to build certain reports (with graphs) to provide them insights into things like their total sales, their busiest time of the day, their top selling products etc. To build these reports, we had all the data but to make sense of that data we would have to build a (or customise existing) graph library. For example, Google charts or Fusion Charts. This would increase our overall development time, which means, more time to go-to-market and get feedback from merchants.

report example

Looker Embed

Luckily, Looker provides a way to embed the already generated reports (looks and dashboards) in your web application. You can read a bit more about it here.

We wanted to control what data different users of the portal can access based on the roles and permissions we already had defined. Looker allows us to do that by using user attributes.

User Attributes for access control

Looker allows us to add attributes which can be applied to users or groups. We can use these attributes as filters to customise what a user sees i.e. based on their roles and permissions, we can tell Looker API what data to show.

For us, the top level filters were country, brand (a company, e.g FairPrice) and a store (FairPrice Bukit Timah). By setting these attributes, we can pass the right value for the logged in user.

Looker takes in user information which it uses to create an embed user. It also takes an id which allows us to make sure that we don’t create duplicate embed users in looker.

Integration

Our service module in our API is responsible for reading all the user attributes and necessary filters and generate an SSO URL which is then passed to the frontend application. The SSO URL is then embedded in an iframe. Looker reports are interactive, which means, users can enable or disable a section of the pie chart. They can also download the data as PDF

You can find a sample Elixir code (since we use Elixir with Phoenix) that generates the SSO URL here. There are examples for other languages as well.

Summary

With this setup, it only takes us few hours to release a new report to our merchant partners. Once our BI team is ready with a dashboard in looker, they configure the report’s embed URL in the admin UI and that report goes live. It also allowed us to quickly build this merchant portal without having to spend a lot of time and effort on implementing a chart library and build features like export to PDF.

However, this integration does have few limitations (like custom filters, cross frame JS interaction etc.) but for now, it suits our needs. In the near future, when a need arises, we might have to build our own charts engine.