HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
segmentio
analytics.js
JavaScript2013–2022
segmentio / analytics.js · Archived

analytics.js

The hassle-free way to integrate analytics into any web application.

11Distinct people
12Mentions
0Explicit recommenders
4.7KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

The hassle-free way to integrate analytics into any web application.

GitHub

Where it is used

No documented product use has been verified yet.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 12:24:10 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year12 dated mentions

Observed mentions: 2013-03-22 20:07:20 UTC to 2022-08-28 23:14:08 UTC.

0122013-01-01 00:00:00 UTC to 2014-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments20132014-01-01 00:00:00 UTC to 2015-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2015-01-01 00:00:00 UTC to 2016-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments2016-01-01 00:00:00 UTC to 2017-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2017-01-01 00:00:00 UTC to 2018-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments20172018-01-01 00:00:00 UTC to 2019-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2019-01-01 00:00:00 UTC to 2020-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments2020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments2021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments2022

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20132013-01-01 00:00:00 UTC2014-01-01 00:00:00 UTC202
20142014-01-01 00:00:00 UTC2015-01-01 00:00:00 UTC101
20152015-01-01 00:00:00 UTC2016-01-01 00:00:00 UTC202
20162016-01-01 00:00:00 UTC2017-01-01 00:00:00 UTC101
20172017-01-01 00:00:00 UTC2018-01-01 00:00:00 UTC000
20182018-01-01 00:00:00 UTC2019-01-01 00:00:00 UTC000
20192019-01-01 00:00:00 UTC2020-01-01 00:00:00 UTC202
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC202
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC000
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC202

What Hacker News says

12 sources
Sure! :) But I think it's all just about few principles. Elaborated a bit more on them: 1. Tailwind CSS classes extracted with purge-css, all inlined. 2. Favicon inlined, small images (<4kb) inlined. Not sure what’s the best threshold. Here is all https://turboeshop.com/inlinedimages/ is all page in one requests. Meaning two big images that are https://turboeshop.com/fastestpageintheworld/ were inlined - results are way worse. So larger images - definitely excluded. 3. Gzip stuff(as one commenter below commented, not done in turboeshop.com/fastestpageintheworld/). 4. Everything from same domain and subdomain. If you want cloudinary or friends, I guess they are only allow subdomain. This is totally OKeish exemption. Or maybe there is a way to work around that cloudinary serves, Cloudflare caches. 5. JS - inlined. Cash.js maybe if you need
Read the rest
jquery replacement, or just vanilla. Little content on vanilla js nowadays :), https://gomakethings.com/articles/ is something interesting. Don’t want to flame here, am not js expert, maybe someone can elaborate. 6. For compex components - svelte web components (or stencils or lithtml) - I’d prefer svelte but am not sure what’s best. 7. Google analytics a) - there is new google analytics (GA4) with measurement protocol2 and new server side google tag manager. Serve side gtm does two things a) serves gtag.js; b) accepts measurement protocol hits and sends to GA. Take a look how it’s done - https://www.simoahava.com/gtm-tips/build-custom-universal-an... , it’s very similar as cloudflare workers, cool stuff. But it’s hosted on Google App Engine, thus - slow. But you don't need google's server anymore, you control full infra, so why not setup simple cache here. 8. Google analytics b) To owerome latency to Google App engine, so you make async proxy in cloudflare workers - one worker to proxy for gtag.js download, one for serving gtag.js from your own domain. <script src=“http://yourdomain.com/workers/gtag/js?id=G-1234455> . Basicly just serve from js cache and check every once in a while if google hadn’t changed their code. Same for GA hits. It used to be google-analytics.com/collect endpoint, server side gtm allows to host collection yourself. You again make worker-proxy, define it in gtag’s transport_url:'https://turboeshop.com/measure' setting and make sure worker returns non-blockingly, and just then forward the measurement protocol hit from worker async-ly with event.waitUntil(). 9. Google analytics c) The gtag.js/analytics.js is a huge file and you have no control, so maybe just use https://github.com/segmentio/analytics.js instead or check out https://www.thyngster.com/app-web-google-analytics-measureme... (search “navigator.sendBeacon”) - craft measurement protocol yourself and send it to gtm. I plan on investigating this but have not yet done that. 10. All the stuff (fb tracking pixel, etc.) you are used to just ‘putting in html’, you instead send as measurement protocol hit dimension and do ETL in google tag manager. 11. All the 3rd party stuff that demands to be executed client-side - you just don’t use that :D (or use, but wisely) 12. HTML - bussiness as usual. 13. So after page reload - double check if all requests are done/received from your own domain. Use curl on each of them to find header CF-cache-status: HIT. They have this ‘varied’ or similar status which means something I can’t remember, but I always fix stuff till ‘Hit’ :) 14. I guess that’s it. Enjoy your own fastest website in the world :)
In The mythical “fast” web page
Just do something that the enterprise world cares about. Remember Segment [1], one of YC's most successful companies, started out as a small open source tool on Github [2]. But even though it was small and had basically no features, the enterprise loved it and asked for more. That's how they realized that they hit a nerve. So writing and releasing OSS may not lead to direct monetization opportunities, but it can be a great way to get in touch with enterprises and to get demand readings quickly. [1] https://segment.com/ [2] https://github.com/segmentio/analytics.js
In Ask HN: Dear open source devs how do you sustain yourself
Segment — San Francisco, Infrastructure Engineering We're looking for engineers to be part of our core engineering team, owning our distributed data processing infrastructure. We process billions of requests a month, growing incredibly quickly, and write primarily in Go and Node.js. In particular, we're looking for new teammates who are comfortable with building and operating distributed systems on EC2. We have a service oriented architecture (hate monolithic repos) and operate one of the largest combined Amazon Redshift clusters. As a team, we love to open-source most of our work: https://github.com/segmentio https://github.com/segmentio/yal https://github.com/segmentio/nightmare https://github.com/segmentio/metalsmith https://github.com/segmentio/myth https://github.com/segmentio/analytics.js We're currently 36 people, with substantial
Read the rest
revenue. But the biggest and most challenging engineering problems lie ahead. We're a key piece of infrastructural data plumbing for thousands of web businesses, and we need to interoperate reliably and seamlessly with hundreds of integration partners. Email myself peteratsegment.com, calvinatsegment.com (cto/co-founder) or drop us a note here: https://segment.com/jobs/descriptions/infrastructure-enginee...
In Ask HN: Who is hiring? (February 2015)
That's a really good point about passive time before the actual building. We had definitely been thinking about the problem for a while, and analytics.js[1] had already existed for at least 6 months in its current form and another 6 months in a prior one. It just takes a while to start developing solid, bigger-picture ideas about a problem. This is also why it's hard to realize the negatives of "pivoting" all the time, since we take for granted how much we've already invested in groking a particular space. The same thing happened recently while hacking on Myth[2]. To everyone on the team it felt like building the entire thing only took a couple days, but really I had been experimenting with a similar idea[3] for multiple months, and it was already being used in production for our own CSS. The piece that took a few short days was just figu
Read the rest
ring our the best way to design the landing page—much less scope that conceiving the entire idea. It's really hard to quantify that kind of time investment, and even harder to explain that to friends who think that everyone is launching fully-formed, successful MVPs in a single weekend without much thought. It definitely seems like something that can only be learned through experience. It's just an earlier stage version of the classic problem of founders always thinking that successful startups spring out of nowhere, when really the multiple years of living in a cramped room and almost killing each other is just shielded from view. At least it makes things more defensible :) Random other thought: I often catch myself bundling up tons of logic into a "first commit" and wishing that that wasn't a common practice, so that we could learn about how the beginnings of codebases are iterated on. [1]: https://github.com/segmentio/analytics.js [2]: http://www.myth.io/ [3]: https://github.com/ianstormtaylor/rework-pure-css
In Thirty Percent Feedback
Segment.io, San Francisco (YC) Segment.io is a web analytics API. We let web companies install analytics once, and then send their data anywhere they need it with the flip of a switch. Our libraries all are all open source, including analytics.js (https://github.com/segmentio/analytics.js), server-side languages, iOS and Android... we launched in January and now process over a billion API calls a month for thousands of websites. Segment.io has four founders. Calvin and Ilya studied CS at MIT, Ian studied Graphic Design at RISD, and Peter studied Aerospace Engineering at MIT. We're hiring our first employee, and our bar is going to be extremely high. We're looking for a full stack javascript programmer, with experience with node.js and backbone. You almost certainly know another language like Clojure or Python. Your responsibilities would
Read the rest
include: + Becoming a core maintainer of https://github.com/segmentio/analytics.js, which runs on tens of millions of computers every month, growing fast. + Building the Segment.io app where users manage their analytics services and data. We use component, d3.js, socket.io, and node.js. Shoot us an email if you're interested! peter@segment.io https://segment.io
In Ask HN: Who is hiring? (June 2013)

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.