and runs during HTML parse, but hubspotutk is set by js.hs-analytics.net, measured loading at ~834ms. On a first visit the cookie does not exist yet, so a single read returns nothing and the visitor gets no external ID at all — and a first visit is exactly what an ad click is. So poll briefly until HubSpot sets it. The SDK loads lazily (~4.5s) and replays a queue, so an init queued a second or two in still lands before any events are transmitted. */ (function attachExternalId() { var attempts = 0; var MAX_ATTEMPTS = 40; /* 40 x 200ms = 8s, then give up quietly */ var timer = null; function tryAttach() { var raw = getExternalId(); if (!raw) { if (++attempts >= MAX_ATTEMPTS && timer) clearInterval(timer); return; } if (timer) clearInterval(timer); sha256Hex(raw).then(function (hash) { oaiq("init", { user: { external_id_sha256: hash } }); }).catch(function () {}); } tryAttach(); /* returning visitor: immediate */ if (!getExternalId()) timer = setInterval(tryAttach, 200); })(); /* --------------------------------------------------------------------------- 2. Load the SDK off the critical path Whichever comes first: the main thread going idle after load, or the first sign of real user intent. No preconnect on purpose — a TLS handshake during LCP for a script we deliberately deferred is a net loss. Measured on clickpost.ai: load event 3614ms, SDK fetched 4508ms. ------------------------------------------------------------------------ */ var loaded = false; var INTENT = ["pointerdown", "keydown", "scroll"]; function loadSdk() { if (loaded) return; loaded = true; INTENT.forEach(function (t) { removeEventListener(t, loadSdk, { passive: true }); }); var s = document.createElement("script"); s.src = SDK; s.async = true; s.fetchPriority = "low"; document.head.appendChild(s); } INTENT.forEach(function (t) { addEventListener(t, loadSdk, { passive: true, once: true }); }); addEventListener("load", function () { window.requestIdleCallback ? requestIdleCallback(loadSdk, { timeout: 2500 }) : setTimeout(loadSdk, 1500); }, { once: true }); /* --------------------------------------------------------------------------- 3. Conversion id sha256(lowercase(email) + "|" + formId + "|" + ISO-hour), first 20 hex, "lead_" prefix. - email lowercased/trimmed so casing does not fork the id - formId keeps two different forms in the same hour from colliding - the hour bucket is only the server's fallback; the id computed here is sent to the relay verbatim, so the two paths cannot disagree even when a submit straddles an hour boundary Ads Manager's own sample omits event_id. We send it so the pixel event and the relay event collapse into one conversion instead of counting twice. ------------------------------------------------------------------------ */ function buildEventId(email, formId) { var seed = [ String(email || "").trim().toLowerCase(), String(formId || ""), new Date().toISOString().slice(0, 13) ].join("|"); return crypto.subtle.digest("SHA-256", new TextEncoder().encode(seed)).then(function (buf) { var hex = Array.prototype.map.call(new Uint8Array(buf), function (b) { return b.toString(16).padStart(2, "0"); }).join(""); return "lead_" + hex.slice(0, 20); }); } /* Guards a re-fire from the history.pushState that book-a-demo-core.js runs after submit, and from back-navigation onto the same state. */ function firedOnce(id) { try { if (sessionStorage.getItem("oaiq_" + id)) return true; sessionStorage.setItem("oaiq_" + id, "1"); return false; } catch (e) { return false; /* private mode / blocked storage: fire rather than lose it */ } } /* Path 2. keepalive lets the request finish even if the page navigates away. Failures are swallowed deliberately: a reporting call must never surface an error to someone who just submitted a form. The relay hashes the email server-side into user.emails_sha256 and adds the caller's IP and user agent, so this event carries the same match signals the pixel gets for free. */ function sendToRelay(email, formId, eventType, eventId) { try { var payload = { token: RELAY_TOKEN, email: email, form_id: formId || "", event_type: eventType, event_id: eventId, /* verbatim, so both paths always match */ source_url: location.href }; var oppref = getOppref(); if (oppref) payload.oppref = oppref; var externalId = getExternalId(); if (externalId) payload.external_id = externalId; fetch(RELAY_URL, { method: "POST", keepalive: true, headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload) }).catch(function () {}); } catch (e) {} } /* Capture the email while the form is still on the page. onFormSubmitted does not reliably carry submissionValues, and by then the form may be removed. */ var lastEmail = ""; document.addEventListener("submit", function (e) { var f = e.target; if (!f || !f.querySelector) return; var i = f.querySelector('input[name="email"], input[type="email"]'); if (i && i.value) lastEmail = i.value; }, true); /* Every HubSpot form on the site reports through this one message event, so no module or theme JS needs editing to add coverage. */ window.addEventListener("message", function (e) { var d = e.data; if (!d || d.type !== "hsFormCallback" || d.eventName !== "onFormSubmitted") return; var email = (d.data && d.data.submissionValues && d.data.submissionValues.email) || lastEmail; if (!email) return; /* without an email there is no stable id to dedupe on */ var eventType = EVENT_BY_FORM[d.id] || EVENT_DEFAULT; buildEventId(email, d.id).then(function (id) { if (firedOnce(id)) return; oaiq("measure", eventType, { type: DATA_TYPE }, { event_id: id }); /* path 1 */ sendToRelay(email, d.id, eventType, id); /* path 2 */ }); }); })();

91ÊÓÆµ

Operations on autopilot, with AI agents. Meet ClickPost Orbit

Home > Blog >

ONDC Statistics 2026: Orders, Sellers, Cities & Growth

ONDC Statistics 2026: Orders, Sellers, Cities & Growth

Teerna Mandal
By Teerna Mandal
Sathish Loganathan
Reviewed by This article has been thoroughly reviewed, fact-checked, and compiled using comprehensive, up-to-date information provided by ClickPost — a trusted authority in logistics and eCommerce shipping solutions. Our editorial process ensures accuracy, relevance, and reliability for our readers. Sathish Loganathan

Ready to ship smarter? Talk to our logistics experts.

Trusted by 600+ brands

In this blog

     

    TL;DR: ONDC statistics 2026

    India's Open Network for Digital Commerce (ONDC) crossed 500 million cumulative transactions on July 25, 2026, including 218 million in FY2026 alone. Much of that volume comes from rides, transit tickets and logistics, so the retail picture (about 116,000 live retail sellers) is far smaller than the headline totals suggest.

    • 500 million cumulative transactions, crossed July 25, 2026 (ONDC)

    • 218 million transactions in FY2026, April 2025 to March 2026 (ONDC)

    • 116,000+ retail sellers live in 630+ cities, December 2025 (Lok Sabha reply)

    • 375,000+ metro and bus tickets booked daily by June 2026 (ONDC)

    • ₹220 crore (about $23.1 million) raised from Zoho, Uber, Paytm and BSE in May 2026

    ONDC statistics are easy to find and hard to trust. In July 2026, India's Open Network for Digital Commerce passed 500 million cumulative transactions, a little over four years after its first order: a bunch of coriander delivered in Bengaluru. Yet the same network gets described with 116,000 sellers or 764,000, and with 616 cities or 1,200.

    Most of those figures are real. They just measure different things, such as registered versus live sellers, or lifetime totals versus a single fiscal year. This page reconciles them, dates every number, and flags widely shared figures we could not trace to an official source.

    Two conventions help readers outside India. The fiscal year runs April to March, so FY2026 means April 2025 to March 2026. One lakh is 100,000 and one crore is 10 million.

    What is ONDC?

    ONDC is an open network, not a marketplace. It is a nonprofit company set up under India's Department for Promotion of Industry and Internal Trade (DPIIT) that publishes shared rules, built on the open-source Beckn protocol, so any connected buyer app can transact with any connected seller app, logistics provider or lender.

    Indian policymakers compare it to UPI, the payments rail hundreds of apps plug into. A seller onboarded through one seller app, such as Mystore, can be discovered on buyer apps like Paytm, Magicpin or Tata Neu without separate integrations.

    For US readers, the nearest analogy is a shared commerce protocol that many storefronts plug into. ONDC was incorporated in December 2021 with the Quality Council of India and Protean eGov Technologies as founding members, per .

    What are the key ONDC statistics in 2026?

    ONDC had processed 500 million cumulative transactions by July 25, 2026, per , including 218 million in FY2026. A June 2026 government backgrounder puts the network at about 1,000 cities and 500,000 sellers, while official data shows roughly 116,000 retail sellers live as of December 2025.

    ONDC master statistics, reconciled (as of November 2026)

    Statistic Figure Source
    Published / as of
    Cumulative transactions 500 million ONDC milestone timeline July 25, 2026
    Transactions in FY2026 218 million (21.8 crore) ONDC FY 2025-26 annual report April 2026
    Registered sellers and service providers 764,000+ (7.64 lakh) PIB factsheet January 2025
    Sellers, all types About 500,000 (5 lakh) PIB Digital India backgrounder June 27, 2026
    Retail sellers live 116,000+ in 630+ cities Lok Sabha reply via PIB December 9, 2025
    Cities with network presence About 1,000 PIB Digital India backgrounder June 27, 2026
    Ride-hailing drivers 900,000+ in 55 cities ONDC FY 2025-26 annual report April 2026
    Daily metro and bus tickets 375,000+ across 35+ apps ONDC milestone timeline June 2026
    Credit disbursed (cumulative) ₹3.75 billion (₹375 crore) ONDC milestone timeline June 2026
    Latest funding round ₹220 crore (about $23.1 million) Inc42, citing board resolution June 2026
    Operating revenue ₹33.4 crore in FY2025 Inc42 Datalabs (company filings) 2026

    Why seller counts disagree:

    The figure of 764,000 counts every registered seller and service provider. The 116,000 figure, from a , counts retail sellers who actually live.

    ONDC's own report counts 900,000+ ride-hailing drivers, more than the whole 2025 registered base, so never add these series together. For a retail brand, 116,000 is the useful denominator, against the 1.4 million+ sellers Flipkart reports on its own marketplace.

    Why transaction counts disagree:

    Lifetime, fiscal-year and monthly totals get quoted interchangeably. Monthly figures are the shakiest: ONDC last reported a monthly order count for May 2025, and the cites about 9 million a month, which does not square with 218 million a year.

    How fast has ONDC grown since 2022?

    ONDC went from its first order in April 2022 to 1 million transactions in May 2023, 100 million in August 2024 and 500 million on July 25, 2026, according to ONDC's own timeline. Annual volume climbed from about 0.2 million transactions in FY2023 to 218 million in FY2026.

    ONDC growth timeline, 2022 to 2026

    Date Cumulative transactions Milestone Source
    April 29, 2022 First order Coriander delivered in Bengaluru ONDC
    May 2023 1 million Food and beverage passes 100,000 monthly orders ONDC
    August 2023 10 million Three months after the first million ONDC
    August 2024 100 million Paperless six-minute loans launch ONDC
    June 2025 250 million ONDC says the network doubled in ten months ONDC
    January 15, 2026 Not reported India Post delivers its first ONDC order PTI
    Late May 2026 450 million 300,000+ daily transit tickets Business Standard
    July 25, 2026 500 million Half-billion milestone ONDC

    Going from 250 million to 500 million took about 13 months. The final 50 million, though, arrived in roughly eight weeks after the . That works out to about 25 million transactions a month (our estimate), well above the FY2026 average of about 18 million.

    Which categories drive ONDC orders?

    ONDC does not publish a regular category split. The last detailed breakdown, for October 2024, showed 5.5 million mobility rides and 8.4 million non-mobility orders in a 14 million-transaction month, . Since then, growth has come mostly from transit ticketing, B2B kirana ordering and D2C brands.

    • Retail orders fell from about 6.5 million in October 2024 to 4.5 million in February 2025, .

    • That drop followed an incentive cut from ₹3 crore per network participant in July 2024 to ₹30 lakh by December 2024, .

    • D2C brands on ONDC buyer apps grew about 38% month on month from October 2025 (ONDC-reported).

    • Bajaj's HamaraMall buyer app handled 200,000+ ONDC transactions a month by early 2026, up 24x since April 2025 (ONDC-reported).

    Our read: the 2024 retail spike was partly bought with incentives, and the 2025 dip showed it. Today's growth areas solve a cost problem for a transit authority or a kirana owner, which makes them slower and more durable.

    In how many cities is ONDC available?

    ONDC had a presence in about 1,000 Indian cities by June 2026, per a PIB backgrounder, up from 616+ in January 2025. Retail sellers live in 630+ cities as of December 2025. A 1,200-city figure circulated in 2024 media reports, but we could not trace it to a current official source.

    • Metro tickets are live in Bengaluru, Chennai, Delhi, Kochi, Pune, Nagpur and on all three Mumbai Metro lines, via 30+ apps (Business Standard, June 2026).

    • Bus tickets covered 21 cities in FY2026, and ONDC-powered autos and cabs ran in 55 cities and towns (ONDC).

    • Bharat Taxi, a driver cooperative on ONDC, operates in seven cities, from Delhi and Noida to Rajkot and Somnath (ONDC).

    • India Post warehouses serve rural sellers in Ahmedabad, Bhuj and Jamnagar, with Madurai among the next sites (ONDC).

    ONDC publishes no metro versus Tier 2 split, so treat exact tier percentages elsewhere with suspicion. The named cities show where the network works best: wherever a public body or cooperative joins, once and every app benefits.

    How much money does ONDC make, and who funds it?

    ONDC raised ₹220 crore (about $23.1 million) from Zoho, Uber, Paytm and BSE Technologies, from a May 12, 2026 board resolution. Its operating revenue was ₹33.4 crore (under $4 million) in FY2025, up 127% from ₹14.7 crore in FY2024, according to .

    ONDC's May 2026 funding round

    Investor Amount
    Zoho ₹70 crore
    Uber India ₹60 crore
    One97 Communications (Paytm) ₹60 crore
    BSE Technologies ₹30 crore
    Total ₹220 crore (about $23.1 million)
    • ONDC is seeking another ₹210 crore from existing and new strategic investors, in June 2026.

    • Beyond its two founding members, 33 banks, exchanges and enterprises have invested, including SBI, ICICI Bank, HDFC Bank and NSE (ONDC).

    Independent director Adil Zainulbhai called ONDC when Uber's stake was announced.

    The more telling detail is who wrote the checks. Uber and Paytm already route rides, tickets and payments over ONDC, so their money buys a voice in infrastructure they depend on. That is validation, and a governance question worth watching.

    What do ONDC's 2026 statistics mean for your business?

    For small sellers and D2C brands

    The numbers favour brands that already have some demand. D2C brands grew about 38% a month on ONDC buyer apps from October 2025 (ONDC-reported). The catch is discovery.

    With roughly 116,000 live retail sellers spread across many buyer apps, visibility depends on which apps carry your catalogue and how hard they promote it, so budget for buyer-app marketing as well as onboarding.

    For enterprise and global brands entering India

    Domino's and Haldiram's appear among ONDC's actively engaged sellers. For a US or global brand, ONDC works best as an incremental channel alongside Amazon and Flipkart: India's e-retail market reached $65 to $66 billion in 2025, per , and ONDC publishes no comparable sales figure.

    CEO Vibhor Jain told The Economic Times that ONDC is focusing on .

    For logistics and post-purchase teams

    Small fleet operators now handle 35% of fulfilled ONDC orders, and average rider pickup time fell from 15 minutes to under 6 (both ONDC-reported).

    on January 15, 2026. Every extra provider on a lane adds its own tracking format and its own way of reporting failed deliveries. ClickPost normalises that layer for brands, with tracking, EDD and NDR workflows across 600+ carrier integrations (vendor-reported figure).

     

    Verdict: should you test ONDC in 2026?

    Yes, if you already have brand demand and can run several logistics partners at once. Probably not yet, if you need a channel to create demand for you. You trade lower platform cost for less predictable discovery, and the 2024 to 2025 retail data shows how quickly subsidised demand fades.

    How big is ONDC beyond retail?

    Mobility and transit now carry a large share of ONDC's volume. ONDC-powered autos and cabs support 900,000+ drivers in 55 cities, and the network booked 375,000+ metro and bus tickets a day across 35+ apps by June 2026, according to ONDC's annual report and milestone timeline.

    • Uber says riders had booked 10 million+ metro trips through its app via ONDC in five cities by June 2026, .

    • ONDC says its subscription model lifted ride-hailing driver earnings by 20% to 50% versus commission models (ONDC-reported, not independently audited).

    • Credit disbursed through ONDC reached ₹3.75 billion (₹375 crore) by June 2026, alongside 1 million+ investment transactions across 29 asset managers (ONDC).

    • Tourism listings passed 850 experiences by June 2026, including 170+ protected monuments (Business Standard).

    If you read 500 million transactions as 500 million shopping orders, you will overestimate ONDC retail by a wide margin. Rides were already about 40% of volume in October 2024, before transit ticketing scaled.

    What is the forecast for ONDC and Indian ecommerce?

    Bain & Company and Flipkart project India's e-retail market will reach $170 to $180 billion in GMV by 2030, up from $65 to $66 billion in 2025. ONDC has published no numeric forecast of its own; its FY2026 report commits only to step-change targets across retail, logistics, mobility and finance.

    Forecasts and forward indicators (projections labeled)

    Indicator Figure Source Horizon
    India e-retail GMV $170B to $180B (projection) Bain and Flipkart, April 2026 $2,030.00
    Quick commerce GMV $65B to $70B (projection) Bain and Flipkart, April 2026 2030
    Additional capital ONDC is seeking ₹210 crore BW Retail World, June 2026 2026
    ONDC monthly run rate About 25 million (our estimate) Derived from ONDC milestones Mid-2026

    A target of 6 million (60 lakh) transactions a day by the end of 2026 is widely quoted. We could not find it in any ONDC or government publication, and the mid-2026 pace was under 1 million a day, so treat it as unconfirmed. Jain has instead described ONDC's aim as an effort to .

    Public transit is the fastest-scaling use case

    Daily metro and bus bookings rose from 300,000+ in ONDC's FY2026 report to 375,000+ by June 2026. A transit authority integrates once and sells through every connected app, exactly the coordination problem an open network handles well.

    Retail is shifting from subsidies to B2B

    13,000+ retailers had joined DigiDukaan across Hyderabad and Jaipur by March 2026 (ONDC). That is a different bet from 2024's consumer food push, which faded once incentives were cut. General trade moves slowly, but kiranas that reorder weekly tend to stay.

    Logistics is decentralising

    35% of fulfilled ONDC orders run through small regional fleets, per ONDC's FY2026 report, and Uber Direct and India Post joined between late 2025 and January 2026. Shippers gain lane coverage but lose some consistency in tracking quality.

    Open protocols meet AI shopping agents

    India had 160 million+ monthly ChatGPT users in 2025, the world's second-largest base, according to Bain. ONDC is building Vyapar LM, its sovereign commerce AI, while US firms push standards such as Google's Universal Commerce Protocol and OpenAI's Agentic Commerce Protocol. ONDC is the largest live test of commerce on shared rails.

    What India's open commerce numbers tell us

    Half a billion transactions sounds large until you set it next to UPI. India's payments rail processed 2 crore (20 million) transactions in FY2017, its launch year, and more than 24,000 crore (240 billion) in FY2026, .

    ONDC's 218 million in FY2026 is well past where UPI started, though commerce is harder to standardise than payments, and ONDC retail has already stalled once incentives ended.

    The durable signals are structural. Transit authorities join once and sell everywhere, and investors like Uber and Paytm now depend on the rails they fund.

    If you sell or ship in India, the practical question is how many logistics partners and channels your operations can absorb without losing visibility. Book a ClickPost demo to see how brands that outgrow single-carrier setups track every shipment and resolve delivery exceptions on one platform.

    ONDC statistics FAQ

    How many sellers are on ONDC in 2026?

    About 116,000 retail sellers were live on ONDC in 630+ cities as of December 9, 2025, per a Lok Sabha reply. Including service providers such as drivers and logistics firms, 764,000+ were registered by January 2025, and a June 2026 government backgrounder cites roughly 500,000 sellers.

    How many transactions has ONDC processed in total?

    500 million cumulative transactions were crossed on July 25, 2026, according to ONDC. The total covers retail, logistics, mobility, transit, tourism and financial services since the first order in April 2022. In FY2026 alone (April 2025 to March 2026), the network processed 218 million transactions.

    In how many cities is ONDC available in India?

    About 1,000 cities as of June 2026, per a PIB backgrounder, up from 616+ in January 2025. Retail sellers were live in 630+ cities in December 2025. Metro ticketing covers seven cities, including all three Mumbai lines, and ONDC ride-hailing runs in 55 cities and towns.

    What is the monthly order volume on ONDC in 2026?

    About 25 million transactions a month in mid-2026, by our estimate from ONDC's 450 million (late May) and 500 million (July 25) milestones. The FY2026 average was about 18 million a month. ONDC has not published official monthly figures since May 2025.

    Which categories have the highest orders on ONDC?

    5.5 million of 14 million transactions in October 2024 were rides, the last published split, so mobility leads by volume. Daily transit tickets reached 375,000+ by June 2026. In retail, food and grocery drove early volume, while D2C brands and B2B kirana ordering lead recent growth.

    How does ONDC compare to Amazon and Flipkart?

    1.4 million+ sellers use Flipkart's marketplace by Flipkart's count, against about 116,000 live retail sellers on ONDC in December 2025. India's e-retail market reached $65 to $66 billion in 2025, per Bain. ONDC publishes no sales value figure, so a like-for-like comparison with Amazon or Flipkart is not possible.

    How much has ONDC raised in funding and who are its investors?

    ₹220 crore (about $23.1 million) in May 2026: Zoho ₹70 crore, Uber ₹60 crore, Paytm ₹60 crore and BSE Technologies ₹30 crore. The Quality Council of India and Protean eGov Technologies are founding members, and 33 other institutions have invested, including SBI, ICICI Bank, HDFC Bank and NSE.

    What is ONDC's daily transaction target for 2026?

    6 million (60 lakh) a day by the end of 2026 is the figure most often quoted, attributed to ONDC leadership, but we found no official ONDC or government source for it. By our estimate from published milestones, the network's actual mid-2026 pace was under 1 million transactions a day.

    The Logistics Automation Platform for E-commerce

    Momentum Leader - G2 Users Most Likely To Recommend - G2 Best Results Mid-Market - G2
    . window.disableHubSpotCookieBanner = true; function killNative() { var n = document.getElementById("hs-eu-cookie-confirmation"); if (n && n.parentNode) { n.parentNode.removeChild(n); return true; } return false; } killNative(); if (window.MutationObserver) { var mo = new MutationObserver(function () { killNative(); }); mo.observe(document.documentElement, { childList: true, subtree: true }); setTimeout(function () { mo.disconnect(); }, 15000); } var COOKIE = "cp_cookie_consent"; var EU = ["at","be","bg","hr","cy","cz","dk","ee","fi","fr","de","gr","hu","ie","it","lv","lt","lu","mt","nl","pl","pt","ro","sk","si","es","se","gb","uk","is","li","no","ch"]; function readCookie(nm) { var m = document.cookie.match(new RegExp("(?:^|; )" + nm + "=([^;]*)")); return m ? decodeURIComponent(m[1]) : null; } function writeCookie(nm, val, days) { var d = new Date(); d.setTime(d.getTime() + (days * 864e5)); document.cookie = nm + "=" + encodeURIComponent(val) + ";expires=" + d.toUTCString() + ";path=/;SameSite=Lax" + (location.protocol === "https:" ? ";Secure" : ""); } function stored() { var raw = readCookie(COOKIE); if (!raw) return null; try { var o = JSON.parse(raw); if (typeof o.analytics === "boolean") return o; } catch (e) {} return null; } function apply(state, revoke) { window._hsp = window._hsp || []; window._hsp.push(["setHubSpotConsent", { analytics: !!state.analytics, advertisement: !!state.advertisement, functionality: !!state.functionality }]); if (revoke && !state.analytics && !state.advertisement && !state.functionality) { window._hsp.push(["revokeCookieConsent"]); } window.dataLayer = window.dataLayer || []; window.dataLayer.push({ event: "cp_cookie_consent", cp_consent_analytics: !!state.analytics, cp_consent_advertisement: !!state.advertisement, cp_consent_functionality: !!state.functionality }); document.documentElement.setAttribute("data-cp-consent", "set"); } function inScope(banner) { if (banner.getAttribute("data-scope") !== "eu_only") return true; var geo = (document.body.getAttribute("data-geo_location") || "").toLowerCase(); if (!geo) return true; return EU.indexOf(geo) !== -1; } function init(banner) { var days = parseInt(banner.getAttribute("data-days"), 10) || 180; var prefs = banner.querySelector("[data-cpcb-prefs]"); var compact = banner.querySelector('[data-cpcb-actions="compact"]'); var expanded = banner.querySelector('[data-cpcb-actions="expanded"]'); var toggles = banner.querySelectorAll("[data-cpcb-toggle]"); function show() { banner.hidden = false; requestAnimationFrame(function () { banner.classList.add("is-visible"); }); } function hide() { banner.classList.remove("is-visible"); setTimeout(function () { banner.hidden = true; }, 300); } function collapse() { if (!prefs) return; prefs.hidden = true; if (expanded) expanded.hidden = true; if (compact) compact.hidden = false; } function expand() { if (!prefs) return; prefs.hidden = false; if (compact) compact.hidden = true; if (expanded) expanded.hidden = false; } function paint(state) { Array.prototype.forEach.call(toggles, function (t) { var key = t.getAttribute("data-cpcb-toggle"); if (key === "necessary") { t.setAttribute("aria-checked", "true"); return; } t.setAttribute("aria-checked", state[key] ? "true" : "false"); }); } function fromToggles() { var state = { analytics: false, advertisement: false, functionality: false }; Array.prototype.forEach.call(toggles, function (t) { var key = t.getAttribute("data-cpcb-toggle"); if (key in state) state[key] = t.getAttribute("aria-checked") === "true"; }); return state; } function commit(state, revoke) { writeCookie(COOKIE, JSON.stringify({ analytics: !!state.analytics, advertisement: !!state.advertisement, functionality: !!state.functionality, v: 1, ts: Date.now() }), days); apply(state, revoke); hide(); } Array.prototype.forEach.call(toggles, function (t) { if (t.disabled) return; t.addEventListener("click", function () { t.setAttribute("aria-checked", t.getAttribute("aria-checked") === "true" ? "false" : "true"); }); }); banner.addEventListener("click", function (e) { if (!e.target || !e.target.closest) return; var btn = e.target.closest("[data-cpcb-action]"); if (!btn) return; var action = btn.getAttribute("data-cpcb-action"); if (action === "customise") { expand(); return; } if (action === "accept") { commit({ analytics: true, advertisement: true, functionality: true }, false); return; } if (action === "reject") { commit({ analytics: false, advertisement: false, functionality: false }, true); return; } if (action === "save") { commit(fromToggles(), true); return; } }); var existing = stored(); if (existing) { apply(existing, false); paint(existing); collapse(); } else if (!inScope(banner)) { // Out of the consent-required region: implied consent, banner never shown. commitSilently(); } else { collapse(); show(); } function commitSilently() { var all = { analytics: true, advertisement: true, functionality: true }; writeCookie(COOKIE, JSON.stringify({ analytics: true, advertisement: true, functionality: true, v: 1, ts: Date.now(), implied: true }), days); apply(all, false); } // Public re-open hook for a footer "Cookie settings" link. window.cpCookieBanner = window.cpCookieBanner || {}; window.cpCookieBanner.open = function () { var s = stored() || { analytics: false, advertisement: false, functionality: false }; paint(s); expand(); show(); }; } function boot() { var banners = document.querySelectorAll("[data-cpcb]"); if (!banners.length) return; init(banners[0]); document.addEventListener("click", function (e) { if (!e.target || !e.target.closest) return; var trigger = e.target.closest("[data-cp-cookie-settings]"); if (!trigger) return; e.preventDefault(); if (window.cpCookieBanner && window.cpCookieBanner.open) window.cpCookieBanner.open(); }); } if (document.readyState === "loading") { document.addEventListener("DOMContentLoaded", boot); } else { boot(); } })();