Skip to content

Karrot's data team extended its app logging system to the web and built a web logging SDK. Over two weeks, 13.6% of web events and 64% of browser IDs came from bots. The team flags bots with an is_bot column instead of dropping them. A read for small sites.

Published

Mika, a frontend engineer on Karrot's data team, published an engineering post on the Karrot tech blog on November 30, 2026. It covers how the team extended its app logging system for user behavior to the web, and the web logging SDK it built along the way, KarrotAnalytics Web SDK. Karrot is the Korean neighborhood marketplace known at home as Daangn. The post came out in Korean and English on the same day.

  • Web events from bots
    13.6%

    Of web events collected over two weeks

  • Browser IDs that were bots
    64%

    Classified as bots in the same two weeks

  • Session timeout
    30min

    Of inactivity since the last action

Source: Karrot tech blog. Both ratios were measured on Karrot's own web products over two weeks.

The code on the product side is short. A service initializes the SDK once, and default logs such as page views start to collect. Product-specific actions are added with track(). The source says that is all there is to using it.

Source codets
karrotAnalytics.init({ serviceName: "service name", countryCode: "country" });

karrotAnalytics.track("event name", {
  [parameter name]: [parameter value]
});

Code: Karrot tech blog

This post reads what the SDK handles behind those two calls, in five parts: the policy the team set first, identifiers and sessions, bots, sending logs as a page goes away, and the guards that keep the host service running. KarrotAnalytics is an internal system at Karrot, and the source does not say whether the SDK will be released outside the company. So this is not a tool to install. It is a record of what has to be decided before collecting web logs.

Karrot was an app-first service for a long time. According to the source, its web products have grown fast, and real estate, part-time jobs, used cars, Neighborhood Life and Groups can now be used from a desktop browser.

The team was already collecting user behavior logs on the web. It used a third-party service to store and analyze events, and that was enough while there were only a few web products and each team looked at its own data. The trouble came when app and web had to be read together. App and server logs sat in the internal system, KarrotAnalytics. Web logs sat in the third-party service. The identity scheme, the event naming rules and the tools all differed, so joining the two sets of data was a separate job every time.

The team decided to support web logs in KarrotAnalytics. The source lists four gains.

  • One place: App and web logs land in the same place. For a logged-in user, app and web behavior can be read as one sequence.
  • Internal tools: Teams can define events in Event Center, run experiments on the experimentation platform and ask an agent about the data.
  • Same method: Web logs are instrumented the same way as app logs. The naming rules are the same, so there is nothing new to learn.
  • Every event: The team owns the data, so it collects every event and does not sample to save cost.

The team wrote down its policy before writing the SDK, because web events and app events behave very differently.

데이터 표
Most visitors are not logged inTell browsers apart, not people
Non-human visitors are mixed inMake it possible to filter out bots
There is no clear moment of opening or closingA visit ends after 30 minutes with no action since the last one
An action alone cannot be analyzedDefine the common fields every event must carry

Source: the Karrot tech blog post, arranged as a table.

The app requires login, so behavior logs can be grouped by user. On the web, most people arrive from a search, look around and leave. The meaning of one visit differs too. An app has a clear moment of opening and closing. On the web, people keep several tabs open or simply walk away. The source says that visit counts, time on site and bounce rate stay stable only once the team has defined where one visit ends.

Non-human visitors come in four kinds: search engine crawlers that index pages for search results, AI search bots that gather material for answers, headless browsers where a program opens Chrome with no screen, and ad and SEO tool bots that check pages carrying ads or factors behind search ranking.

The fourth decision is the common fields. An event has to say what the action was and also in what context it happened. So the team first fixed the information that must be present for web analysis to mean anything. The SDK is these four decisions turned into code.

To tell anonymous visitors apart, the SDK gives each browser an identifier, web_device_id. On a first visit it generates a UUID and stores it. On later visits it reads the stored value.

Where local storage is not available, as in private browsing, the identifier lives in memory only. A reload issues a new one, and the SDK does not count that as a first visit. This keeps the metric from being inflated. When a user logs in, the host service calls identify(), and every event after that carries the user ID. Calling reset() clears it.

A session is one record in localStorage holding sessionId, lastActivityAt and startedAt. Expiry is not decided by a timer. It is decided by a comparison at the moment the record is read.

Source codets
const SESSION_TIMEOUT_MS = 30 * 60 * 1000;

function isExpired(session: StoredSession, at: number): boolean {
  return at - session.lastActivityAt > SESSION_TIMEOUT_MS;
}

Code: Karrot tech blog

The source gives two reasons for not ending a session with setTimeout after 30 minutes.

  • When a tab goes to the background, the browser slows or stops its timers.
  • In an MPA, where every page is a fresh load, the timer disappears with the memory the moment the user moves to another page.

Instead, the SDK updates lastActivityAt on every event. If 30 minutes have passed, it creates a new session and records web_session_start. Tabs on the same domain share localStorage, so a visit that moves across tabs stays in one session.

There is also a guard for storage that fails. The SDK keeps a memory cache next to storage and uses whichever of the two has the more recent lastActivityAt. Where only writes fail, a stale stored value could otherwise hide the cache and create a new session on every event.

The numbers the team measured are the most striking part of the post. Over two weeks, 13.6% of web events came from bots. In the same period, 64% of browser IDs were classified as bots.

The gap between the two ratios comes from how identifiers are issued. A bot starts each visit with a new browser whose storage is empty. With no stored identifier, every visit counts as a new visitor. In the source's words, bots inflate the number of new visitors far beyond their share of events.

There are two ways to handle bots: drop them at collection, or accept everything and mark it as bot traffic. Karrot chose to mark, for two reasons.

  • The detection rules keep changing. When a new bot appears the rules have to be fixed, and data that was dropped cannot be read again.
  • Records of people who were wrongly classified remain, so they can be checked later.

So every web event has an is_bot column, and analysis filters with is_bot IS NOT TRUE. A NULL value means there was no information to decide on.

Two signals feed the decision. One is the User-Agent. Search engine crawlers and AI search bots state their own name there. The other is navigator.webdriver, a flag that a browser under an automation tool turns on by web standard. It is the only such value the SDK puts in an event.

The decision is made on the collection server, not in the browser, because anything a browser reports about itself can be faked.

Web SDKBatches and sends events, attaching only the webdriver value
Event collection serverOverwrites the User-Agent in the body with the request header and accepts allowed domains only
CleansingClassifies with a User-Agent parser and decides on bots
AnalysisFilters with is_bot IS NOT TRUE
  • Web SDK → Event collection server
  • Event collection server → Cleansing
  • Cleansing → Analysis
Source: Karrot tech blog. The cleansing stage runs on Flink.

The cleansing stage classifies browser, operating system and device type with a User-Agent parser. It then marks the event as a bot if any one of the three conditions below holds. If the event body arrives with an is_bot value, that value is removed and only the server's verdict is kept.

  • The parser classifies the device as a robot
  • The User-Agent contains HeadlessChrome
  • webdriver is true

For the same reason, browser, operating system, device type and country are not filled in by the SDK. The server works them out from the request.

An app stays alive in the background. On the web, everything is gone the moment a tab closes. Several parts of the transport exist for that reason.

Events are not sent as they happen. They collect in a buffer. Every 3 seconds, or once 30 events have piled up, the buffer is emptied, and the batch is split into chunks of 100 events or 64 kB to form requests. This is also why each event carries both the time it happened (event_ts) and the time it was sent (sent_ts). The difference between the two is the time spent waiting in the buffer.

Image: Karrot tech blog

The keepalive option of fetch lets a request continue after the page is gone. According to the source, though, browsers cap the total of keepalive requests per page at 64 kB. A large batch sent with keepalive goes over the cap and fails silently. So the SDK sets keepalive only on requests of 16 kB or less and sends larger ones as a plain fetch.

When the page is really closing, the SDK uses navigator.sendBeacon instead of fetch. There is no response to read, but the browser takes responsibility for delivery after the document is unloaded.

The SDK also separates looking at another tab for a moment from leaving for good.

데이터 표
visibilitychange (hidden)Flushes the remaining events only
pagehideRecords web_page_leave and flushes the remaining events
pageshow (persisted)Records web_page_view again and keeps tracking

Source: Karrot tech blog. persisted means the page was restored from bfcache by going back.

If web_page_leave fired whenever a tab was hidden, every tab switch would be recorded as leaving, and time on page would be wrong. So the leave record is written on pagehide only.

A logging SDK runs inside the host service, so a problem in the SDK is a problem in the service. The source says taking the service down is a much bigger incident than losing logs, and sets three invariants.

  • Errors never escape. Exceptions are swallowed and recorded, and reach the console only when debug: true.
  • Nothing breaks under SSR. Browser APIs are never touched at module top level, and browser features are used only behind an isBrowser() guard. On the server globalThis is shared between requests, so the singleton registry returns a fresh instance each time.
  • shutdown() restores everything. When the host takes the SDK down, it sends the remaining events and then puts back listeners, timers, global patches and stored values.

Retries have a ceiling too. A send result falls into one of three classes by HTTP status code.

데이터 표
2xxSuccess
429Retry. If there is a Retry-After header, follow it
408 and 5xxRetry
400, 403 and the restDrop. Sending again would give the same result

Source: the classifyResponse code in the Karrot tech blog post, arranged as a table.

The retry delay starts at 3 seconds, doubles each time and never exceeds 30 seconds. Even if the server keeps returning 5xx, the SDK asks only once every 30 seconds, and the source describes this cap as acting as a circuit breaker in effect. Failed events go back to the front of the buffer to keep their order, and an event that has been attempted more than 10 times is dropped.

Default logs collect without any instrumentation. There are four: web_first_visit, web_session_start, web_page_view and web_page_leave. What the source says took the most care in auto-capture is recording web_page_view exactly once per page in every environment.

데이터 표
MPAOnce, when the page loads
SPAhistory.pushState and replaceState are wrapped, and back and forward are detected with popstate. Consecutive calls are merged and the same URL as the last one is not counted
SSRNothing on the server. Once at init, after hydration finishes
bfcache restoreThere is no load event, so it is recorded again on pageshow

Source: Karrot tech blog.

A site does not need Karrot's scale to take something from this post. A person running one blog or one landing page also looks at visits and new visitors. The post contains a standard for reading those numbers.

데이터 표
Measured and confirmed that bots inflate new visitor countsCheck first whether the new visitor count is the value after bots are filtered
Keeps bot records and marks them with an is_bot columnIf you store logs yourself, mark with one column and do not filter and delete
Decides session expiry by comparing the last action time, not by a timerIf you split sessions yourself, store the last action time and compare on read
Sends the leave record on pagehide with sendBeaconIf you measure exits and time on page, do not record leaving on visibilitychange
Detects bots on the server from the request headerDo not decide who is human from values the client sends alone

The left column is from the Karrot tech blog. The right column is this post's own summary and is not in the source.

A site that uses an external analytics tool has nothing to build here. What it can do is check, in the tool's settings and documentation, how the tool treats bot traffic and after how many minutes it ends a session. Then the numbers can be read against the same standard.

The end of the source covers developer tooling. Because the SDK batches events every 3 seconds and sends them gzipped, the request bodies are hard to read in the browser's Network panel, so the team built an internal Chrome extension that shows events inside Chrome DevTools. The source also says most events are now registered through MCP, and that the logging conventions are packaged as a skill, so naming an event and checking for duplicates both finish inside the AI tool.

The center of this post is the order of work, not the SDK code. The team first wrote down what identifies a visitor, how bots are treated, where one visit ends and what every event carries. Numbers in the code such as 30 minutes, 16 kB and 10 attempts all follow from that policy. Because the policy came first, each number has a reason attached.

The same order works in design. It resembles the way a design system fixes tokens and rules before any screen is drawn. In logging, those rules are event names and common fields.

For anyone running a blog or a community, this changes how a visit count is read. If 64% of identifiers were bots, a graph of rising new visitors cannot be taken at face value. That figure was measured on Karrot's web products over two weeks, though. It comes from a service with heavy search traffic and many pages, so it does not carry over to other sites. The ratio for a given site has to be measured on that site.

Some things cannot be known from the source. It does not give the share of people wrongly classified as bots, or how many bots get past detection. The source itself names two remaining tasks: making sure logs arrive from pages that live only for a very short time, and telling newly appearing bots apart better.