Josephine Liu, Sherry Huang on June 9th 2021

Our latest feature, Journeys, empowers teams to unify touchpoints across the end-to-end customer journey.

All Company articles

Jake Peterson on April 22nd 2014

After working closely with the Facebook Ads team we’ve released support for Facebook Custom Audiences. Now Segment users can use audiences without code changes!

About Facebook Custom Audiences

Custom Audiences is an ad targeting option that lets advertisers find their existing audiences among people who are on Facebook. You can use the ads create tool or use Power Editor to create a Custom Audience.

Learn More Here

Calvin French-Owen on April 8th 2014

On April 7th (yesterday), a new zero-day vulnerability in OpenSSL was revealed, dubbed the “Heartbleed“ exploit. It allows the attacker to read a random 64-kilobyte section of memory from any server accepting SSL connections with a compromised version of OpenSSL. We’ve patched the vulnerability in our service and taken steps to avoid further information leakage.

Like many other sites, we use Amazon Web Services’ Elastic Load Balancers and Cloudfront distributions to carry out our SSL termination. Both of these services were running OpenSSL versions that were vulnerable to Heartbleed. Our particular load balancers and distributions were patched this morning by 7:30am PST.

We’re taking a number of additional steps to make sure your information is kept safe and secure.

  • We’ve generated new private keys for all of our SSL certificates and updated them. We updated the certificates shortly after detecting that our ELBs had been patched.

  • We’ve reset all user sessions for Segment.

  • We’re in the process of revoking our old certificates.

We don’t have any reason to believe that Segment was actually a victim of any malicious activity. However, due to the nature of the bug, there’s no way to guarantee that an attacker didn’t try and gain access to private information. If you’d like to be extra cautious, we recommend resetting your Segment password.

We take your security and privacy extremely seriously, and we’ll continue to do our best to be as transparent as possible. If you have any questions or concerns, don’t hesistate to email us at friends@segment.com.

Julian Gruber on April 3rd 2014

This is the first part of a series about our newest feature: the live debugger! Here is how we used the new Server-Sent Events standard to implement the real-time stream that helps you debug all of the calls going through our servers.

This is the first article in a series about how we built Debugger. To try it out, log in to segment.com, go to a project of yours and choose Debugger.

Why another spec?

In the web we unfortunately don’t have as many options for streaming network calls as with native apps, where you’d most likely just do raw tcp or udp.

The commonly used techniques are:

  • Polling Ajax / JSONP

  • Websockets

  • Flash

  • Server-Sent Events (SSE)

  • (Gifsockets ;))

Each have their pros and cons, and we could have successfully implemented Debugger with any of those. However many have big downsides, like polling creating too many connections, websockets requiring an HTTP upgrade and Flash being proprietary technology.

In the end we chose SSE because it’s the most simple and straight forward approach, both in concept and implementation, and does just what we need.

Server-Sent Events

I first learned about SSE from @konstantinhaase, who explained to me how Travis CI is using them for their live build updates. I was arguing why not to just use WebSockets, but in comparison WebSockets are a complex monstrosity and only shine when you need full 2 way communication.

All there is to SSE is the browser makes an HTTP request to an HTTP server which responds with lines prefixed by data: and delimited by \n\n. Boosh! There’s no weird HTTP upgrade, the server side can be dead simple and since it’s just HTTP it plays well with your existing stack of firewalls, webservers etc.

Unlike with polling you do still get persistent connections, so if you do auth logic on every request you only have to do that once per client.

An example SSE endpoint would respond like this:

It’s so simple you’ll wonder why SSE are still so little known.

The code to listen on the client is:

And here’s a server written in node.js, writing the current date every second. Don’t forget to set the Content-Type header to text/event-stream.

Advantages

The biggest advantage is how lightweight SSE are: It’s raw http and you can make it work in a few lines of code without using any libraries. For legacy browser support there are polyfills that work with pure JS.

Browser support

None of the Internet Explorers support SSE yet, and mobile Opera and Android don’t either. However, all recent versions of Firefox, Chrome, Safari and Opera do.

For the rest, there’s multiple polyfills. There’s one by Yaffle that’s smart about reconnecting and supports CORS, but also requires a modification to the server. The one by remy seems popular as well and is more lightweight but at the same time less robust.

Tuning reconnections

EventSources reconnect by default, but you can tune the reconnection behavior based on your app’s requirements, stack and expected clients:

  • Send a line of retry: <milliseconds> to configure the client’s reconnection time.

  • Send a line of id: <id> before a data line to associate an unique id with the event. The browser will keep track of that id and in case of a reconnection will add Last-Event-ID as an HTTP header to let the server be smart about what to send the client straight away. For example, in a chat scenario you would send all the messages that happened since the last message the client has seen.

Custom event names

In case you’re sending different kinds of events, like a room join and a messageevent, SSE let’s you differentiate those in the stream. Send a line of event: <name>\n before a data line to let the EventSource know that’s what you’d like to call that event.

For example:

Will trigger:

Deployment

Some software has problems with long living connections, here’s what we had to tweak in our stack:

  • Add the proxy_http_version 1.1; directive to our nginx proxy so it doesn’t close connections too early

  • Send heartbeats every 30s because Amazon ELB kills idle connections after 60s

Helpful libraries

The segmentio/sse component is a nice wrapper for client side subscriptions. Install with component(1).

If your data source on the server side is a node stream, there’s the segmentio/sse-stream node module, a transform stream that converts to the SSE format:

Links

In the next installment of this series we’ll look at how live debugger is built upon generators and koa for fun and profit. Stay tuned!

Jake Peterson on March 11th 2014

We’re happy to announce an integration with MailChimp! MailChimp is a popular and simple email service provider. We use it here at Segment to send out our blog and academy emails.

This integration is simple, but useful: Every time you identify people with an email address included, we’ll add that email + first name + last name + user id to your Mailchimp list.

If you want to stay updated on all the tools we add to Segment make sure to subscribe to the blog!

Ian Storm Taylor on March 11th 2014

We’re excited to announce our newest feature on the path to making your analytics setup as dead-simple as possible: the live debugger!

It’s a new page in your Segment project view that lets you see every API call you make from your website or mobile app in real-time as they hit our servers. Check it out:

That means you can make sure that everything is being sent just as you anticipated without having to wait for any sort of data processing, so getting set up with Segment is even quicker.

The tech behind the real-time-ness of the debugger is actually pretty interesting. Next up, Julian’s going to be writing about how he designed and built it out; it’s actually pretty simple. So stay tuned!

Peter Reinhardt on February 19th 2014

We’re finally announcing an integration with Lucky Orange! Lucky Orange is an analytics tool focused on qualitative data. It gives you visitor heatmaps, visitor polls, visit recordings, and live chat. Here’s a quick demo of how their screen recordings can help you capture problems with your site:

If you want to stay updated on the other cool, new tools we add to Segment make sure to subscribe to the blog!

Jake Peterson on February 19th 2014

Today we’re releasing support for loading your Twitter Ads conversion pixels through Segment.

If you run promoted Tweets, it’s super valuable to measure the ROI on that advertising spend. By dropping Twitter’s ad conversion pixel onto the page after your customer converts, then you can measure that ROI inside Twitter’s ad tools.

Now you can trigger the Twitter Ads pixel based on any custom event through Segment, without touching any code! Just enter the name of the custom event you’re sending right now that should trigger the pixel, and we’ll load the corresponding Twitter pixel id automatically.

If you’re ready to get Twitter Ads set up, here’s a walkthrough of where to find the Twitter pixel id!

If you want to stay updated on the other cool, new tools we add to Segment make sure to subscribe to the blog!

Jake Peterson on February 19th 2014

We’re announcing our integration with Google Adwords today! You can now trigger your Adwords conversion pixels through Segment, without writing any new code!

If you buy adwords to display in Google search results, measuring the ROI of that ad spend is critical. To measure the ROI you just need to connect the ad spend to “conversion” events. For example, on a “Completed Order” page, you can load Google Adwords’ conversion pixel. Then you’ll be able to see your ad spend ROI inside adwords.

To trigger the pixel with Segment, just enter the name of a custom event you’re sending right now, and enter the Adwords pixel id that you want to trigger when the event happens.

When you’re ready to get Google Adwords set up, here’s a walkthrough of where to find the necessary settings:

If you want to stay updated on the other sweet, new tools we add to Segment make sure to subscribe to the blog!

Peter Reinhardt on February 19th 2014

Today we’re announcing support for Curebit! If you’re an e-commerce company, Curebit can help you get more social referrals and drive them to purchase. They can help you set up a referral program that drives people to share your e-commerce site with friends, then help you measure results and tune the system.

You can toggle Curebit on inside Segment – sending an Completed Order will trigger Curebit’s register_purchase event to help you measure the ROI of your referral program.

More e-commerce related news is coming soon!

If you want to stay updated on the other cool, new tools we add to Segment make sure to subscribe to the blog!

Become a data expert.

Get the latest articles on all things data, product, and growth delivered straight to your inbox.