The Future of Analytics.js

By Peter Reinhardt

Right before Christmas we launched analytics.js on HackerNews and the support has been tremendous! In just 24 hours the repo broke 1,000 Github stargazers, and since then the community has helped us add new integrations. But we’re just getting started, and we’re super excited to share an even easier way to integrate analytics with you.

In case you missed it, analytics.js is a wrapper for your client-side analytics services. Instead of littering your app with a bunch of hooks for all the analytics services you want to integrate, analytics.js exposes a simple API that routes your data to all of them!

There’s an enormous variety of analytics services available today, and most of them collect the same data in slightly different ways. When you’re integrating several of these tools the code gets messy real quick. Analytics.js paves over the differences and keeps your code clean.

The community has already helped add support for five more integrations:

asset jGjT9eNC

And we’re only just getting started! We’re committed to adding more in the coming months, because we think analytics.js is the best way to add analytics to a web app. And we’re happy that lots of you seem to agree from the awesome responses we’ve received! Our favorite tweet so far looked like wild cursing at first:

Image 2020-04-24 at 3.44.07 PM

But we were pleasantly surprised when we realized it translated to something along the lines of “OMG WHERE WAS THIS ABSTRACTION 8 MONTHS AGO!?!?!?!”.

And we’re making it even easier.

We’ve launched Segment—a hosted version of analytics.js that lets you toggle analytics services off and on with a single click. You can literally swap analytics integrations without touching a single line of code.

asset yid1TqJ4

All of your analytics integrations for all of your projects, no matter how big or small, are managed in one place. For companies this means your site, your blog, your different services; for hobbyists this means all of your side projects! And it comes with a simple dashboard for monitoring activity across all your projects at a glance.

Segment is a much more powerful version of analytics.js. And it won’t be limited to client-side javascript. We’re taking it server-side too!

Server-side libraries and a REST API.

Lots of projects require sending analytics data server-side because some events, like nightly cron jobs, are only available on the server. But integrating analytics server-side is an even bigger headache than in the browser. Not only do developers have to learn a new API for every integration, but they also need to build queuing systems to avoid multiple HTTP requests for every action a user takes.

We’re currently beta-testing a simple REST API that performs the same routing as analytics.js. You hit our servers once and we send the data to any analytics services you choose. Which means no additional requests and no extra code.

Along with the REST API comes a series of clean, server-side libraries with proper queuing and batching to keep your integration as performant as possible. The routing happens on our servers, so you save on outbound requests. And you don’t need to risk changes in production just to try out a new analytics solution.

Any node or python developers out there who want in the beta? Get in touch!

Mobile libraries too!

Next up are mobile libraries with proper queuing and offline support so that you don’t have to manage all the details yourself. Which means no matter which integrations you choose to turn on, you’re guaranteed to get a mobile-friendly client library. We’ll route your data wherever you want, so you can try out a new dashboard or lifecycle email tool without a release to the app store.

Trying new analytics should be easy.

Everyone knows that analytics are extremely important for success, but right now integrating analytics services is a huge headache. Our vision is to remove the barrier to integrating analytics, so that your codebase stays clean and you can try new analytics tools in minutes. If you’re interested we’d love to hear what you think of Segment!

The state of personalization 2023

The State of Personalization 2023

Our annual look at how attitudes, preferences, and experiences with personalization have evolved over the past year.

Recommended articles

Loading

Want to keep updated on Segment launches, events, and updates?