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 >

10 Ecommerce & Logistics Trends in India 2027 (With Statistics)

10 Ecommerce & Logistics Trends in India 2027 (With Statistics)

Manjusha Pal
By Manjusha Pal
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 Summary

    India's online retail market is on track to cross , its fastest growth in five years. In 2027, smaller cities will supply most new demand, and return costs and new consumer rules will decide which operators turn that demand into profit.

    • projected size of India's ecommerce market in 2027.

    • e-retail shoppers in India in 2025, with Gen Z at 40% to 45% of them.

    • 37.51% vs 5.28%: RTO rates for COD and prepaid D2C orders in FY2026.

    • Blinkit's dark store target for March 2027, up from 2,751 in September 2026.

    • e-commerce grievances filed with the National Consumer Helpline in 2025, about 29% of the total.

    Indian shoppers spent about of the 2026 festive sales, and first-time buyers doubled from a year earlier. Much of that new demand comes from smaller cities. The biggest ecommerce trends in India for 2027 are about serving those buyers profitably, because their orders cost more to deliver and fail more often.

    Cash on delivery still accounts for 55% to 70% of D2C orders and carries most of the return risk. Dark stores are moving into towns where quick commerce profitability is still unproven. On January 1, 2027, take effect for every e-commerce entity in India.

    How big will India's ecommerce market be in 2027?

    India's ecommerce market is projected at , according to Mordor Intelligence. That figure covers online goods and services across B2C and B2B. Retail goods form a smaller core, and Redseer expects online retail GMV to cross after 25% growth in the first half.

    Source What it measures Figure Period
    Mordor Intelligence Online goods and services, B2C and B2B 2026
    Redseer Online retail GMV H1 2026
    Redseer Online sales in the 30 to 35 days before Diwali (projection) 2026
    Bain and Flipkart Quick commerce share of e-retail GMV 2025

    Growth is shifting toward everyday categories. Grocery is set to overtake mobile phones in 2026 as online retail's second-largest category, behind fashion. Redseer partner Kushal Bhatnagar summed it up: For delivery networks, that means more frequent, lower-value orders per customer.

    What are the top ecommerce trends in India for 2027?

    Most of the top ecommerce trends in India for 2027 come back to logistics. Demand is growing fastest in smaller cities and among Gen Z shoppers, and the margin on those orders depends on how well brands control returns and place inventory.

    1. Quick commerce expands into Tier 2 and Tier 3 cities

    Blinkit expects to cross , up from 2,751 at the end of September 2026, with most new stores in smaller cities. That push lands on a large base. Quick commerce GMV in India reached and has doubled every year since 2023.

    • Amazon Now crossed by September 2026 and served more than 60 cities from over 750 fulfilment centres.

    • India's micro-fulfilment network passed by late 2025, and two-thirds of new additions landed in the top ten cities.

    2. ONDC passes 218 million yearly transactions, with a small lift to retail

    ONDC enabled across commerce and mobility services. Retail is only part of that total. Mordor rates the network's lift to India's ecommerce growth at about , which makes ONDC a side channel for most retail sellers in 2027.

    • UPI adoption in smaller cities adds about 5.6 points to the same projected CAGR, four times the estimated ONDC effect.

    • Flipkart in July 2026, which narrows the fee advantage open networks have offered sellers.

    3. Generative AI moves from pilots into production

    had multiple generative AI use cases live in production by late 2025, according to an EY and CII survey of over 200 organisations. Another 23% were still running pilots.

    • India became the world's second-largest ChatGPT market in 2025, with more than , about a third of them Gen Z.

    • expected generative AI to have a significant business impact.

    Bain notes that shoppers rarely complete purchases through chat assistants yet. The clearer payback sits in logistics, where address checks at checkout and automated follow-up on failed deliveries both cut RTO.

    4. Tier 2+ cities and Gen Z shoppers drive half of incremental orders

    Tier 2+ cities contributed , according to Bain. Gen Z, at 40% to 45% of online shoppers, also drove nearly half of incremental orders. Both groups are early in their online buying, which leaves a long runway for growth.

    • Only in Tier 2+ cities shopped online in 2025, against 45% to 50% in metro and Tier 1 cities.

    • Tier 2 and Tier 3 cities received in 2026, ahead of 78% in metros, across more than 80 million orders.

    • Tier 3 pincodes returned 23.73% of orders on ClickPost's FY2026 network, more than double the 10.92% metro rate.

    5. D2C order volumes grow by a third, pushing brands toward multi-carrier shipping

    India's D2C market is estimated at and is expected to reach $60 billion by 2030, according to Unicommerce. D2C order volumes rose 33% in FY26. At that pace, many brands outgrow single-courier or in-house shipping within a year or two.

    • D2C orders , while GMV rose 45%, as order values climbed.

    • E-commerce parcels in India totalled an estimated .

    • Hyperlocal shipments from quick commerce and food delivery form the fastest-growing parcel segment, with a projected 33% to 50% CAGR to FY2030.

    6. COD orders return at seven times the prepaid rate

    COD orders on ClickPost's FY2026 network returned to origin at 37.51%, against 5.28% for prepaid orders. Each RTO on a ₹1,200 order costs about ₹350 once both shipping legs and lost acquisition spend are counted. Payment mix is therefore the largest single RTO lever a brand controls.

    • 97% of RTOs began as a failed delivery attempt on ClickPost's network.

    • First-time buyers return about 29% of orders, falling to about 22% by their sixth to tenth order.

    • COD-heavy fashion and apparel brands typically run RTO between 21% and 32%.

    • Across all payment modes, failed delivery attempts fell to from 22%, and RTO dropped to 10% from 11%.

    Since nearly every RTO starts as a failed attempt, the hours after the first non-delivery report are when most orders can still be saved. First orders carry the highest risk, which makes them the natural place to push prepaid.

    7. Returns warehousing becomes the fastest-growing part of reverse logistics

    India's reverse logistics market is projected to grow from , a 15.57% CAGR. Returns warehousing is the fastest-growing function in that market.

    • Warehousing for returns is projected to grow at .

    • Consumer and retail held 46.80% of India's reverse logistics market in 2025.

    • Transportation accounted for 49.05% of reverse logistics spend in 2025.

    8. B2B ecommerce outgrows B2C as lead-generation platforms slow

    B2B ecommerce is projected to grow at , ahead of the 15.42% rate for India's overall ecommerce market. That makes B2B the fastest-growing business model in the forecast, though it starts from a far smaller base.

    • B2C held 86.22% of India's ecommerce market value in 2026.

    • IndiaMART recorded in Q2 FY27, and its paying supplier base stood at 217,000.

    IndiaMART's flat enquiries and shrinking supplier base point to growth moving inside B2B, from lead generation toward completed transactions with delivery attached.

    9. EV delivery fleets scale on routes that stay fully loaded

    Amazon runs and expects the fleet to pass 20,000 within a year. In October 2026 it also announced 3,000 electric trucks with Tata Motors over three years. Among last-mile delivery trends in India, EVs now pay off on dense, high-use routes.

    • EVs cost than diesel vehicles, while their daily operating costs run 10% to 15% lower.

    • By October 2026, Amazon had set up 10 charging yards across India, and each yard can charge 35 trucks at once.

    Amazon operations vice president Abhinav Singh put it plainly: Empty return trips break that math. Intra-city loops between hubs and dark stores keep vehicles loaded, which is why quick commerce and EV fleets are scaling together.

    10. Warehouse supply grows 12% to 14%, with Grade A space taking a larger share

    ICRA expects warehousing supply across India's eight primary markets to grow 12% to 14% in FY2027, reaching . Third-party logistics and manufacturing remain the main demand drivers. Total space is rising steadily, so the 2027 constraint is quality space in the right corridors.

    • India's industrial and warehousing stock stood at across eight major cities.

    • Grade A space grew about 20% year on year to 293 million sq ft, or 57% of total stock, in Q1 2026.

    • Warehousing took 72% of gross absorption in Q1 2026, at 13.2 million sq ft.

    What are the new e-commerce rules in India effective January 2027?

    The Consumer Protection (E-Commerce) (Amendment) Rules, 2026 take effect on . Every announced discount must show a prior price, defined as the lowest price of the preceding 30 days. Sponsored listings need clear labels, and each platform must run a yearly dark-pattern self-audit and display a compliance certificate.

    • The Department of Consumer Affairs notified the amendment on September 9, 2026, and announced it on September 10, 2026.

    • The National Consumer Helpline received .

    • Marketplaces must disclose importer details and country of origin for imported goods.

    Rule area What the amendment requires Likely internal owner
    Price reductions Reduced price shown next to the lowest price of the previous 30 days 91ÊÓÆµ and category teams
    Sponsored listings Clear and prominent disclosure on every paid placement Ads and search product team
    Dark patterns Yearly self-audit plus a visible compliance certificate Product design and legal
    Search results No manipulation that misleads users or hurts relevance Search and ranking engineering
    Consumer data Express, affirmative consent before specified uses Data protection and CRM
    Grievances Helpline convergence and complaint copies for buyers Customer support

    The prior-price rule is the one most likely to catch D2C brands off guard. Many sale banners compare against a list price that has not been charged in months. From January 1, that comparison has to use the lowest price of the previous 30 days.

    What is the forecast for India's ecommerce and logistics market to 2030?

    India's quick commerce GMV is projected to reach , about six times its 2025 level, according to Bain. Parcel volumes rise with it. Redseer projects , more than double the FY2025 base of 10 to 11 billion.

    Metric Projection Source Horizon
    India ecommerce market Mordor Intelligence 2032
    E-commerce parcel shipments Redseer FY2030
    Industrial and warehousing stock, 8 cities JLL 2030
    Blinkit dark stores Eternal March 2028
    Quick commerce share of incremental e-retail GMV Bain and Flipkart 2026 to 2030
    Traditional e-retail share of e-retail GMV Bain and Flipkart 2030

    If these projections hold, delivery networks will carry two very different flows by 2030. One is dense, minutes-level grocery delivery inside cities. The other is longer-haul parcels to smaller towns, where failed deliveries cost the most.

    What do the ecommerce trends in India for 2027 mean for operations leaders?

    For chief ecommerce officers and D2C founders

    in 2025 concerned e-commerce, which explains why compliance tops the 2027 agenda. A review of price banners and sponsored tags before January 1 carries the most urgency.

    For logistics and last-mile heads

    88.5% of orders that fail three or more delivery attempts end in RTO, against 20.2% after a single failed attempt. Each extra attempt sharply lowers the odds of a save, so NDR follow-up speed is a cost lever.

    For supply chain and fulfilment heads

    47% of shipment volume on ClickPost's network now goes to the Tier 2 and Tier 3 long tail. Node planning for 2027 works best when it starts from that order density and from 3PL pincode depth. Returns grading inside the same node is worth designing in from day one.

    India ecommerce and logistics statistics for 2027 at a glance

    Statistic Figure
    Online retail GMV, 2026 (projection) Over $90 billion
    Online shoppers in India, 2025 290 to 300 million
    Gen Z share of online shoppers, 2025 40% to 45%
    Quick commerce GMV, 2025 $10 to $11 billion
    Blinkit dark stores, September 2026 2,751
    RTO rate, COD vs prepaid D2C orders, FY2026 37.51% vs 5.28%
    RTO rate, Tier 3 pincodes vs metros, FY2026 23.73% vs 10.92%
    On-time delivery, Tier 2 and 3 vs metros, 2026 festive season 83% vs 78%
    E-commerce share of National Consumer Helpline grievances, 2025 About 29%
    Warehousing supply in eight primary markets, FY2027 (forecast) 550 to 570 million sq ft

    Verdict: where 2027 budgets earn the most

    RTO reduction offers the fastest payback for COD-heavy brands, because every COD order moved to prepaid drops into a far lower-risk group for the price of a small incentive. Compliance work ranks a close second, since the January 1 deadline will not move.

    Quick commerce deserves a listing strategy in smaller cities. Owning dark-store inventory there is a bigger bet while profitability beyond Tier 1 stays unproven. ONDC is worth a small pilot. EV fleets make sense wherever routes stay loaded, and the case weakens on routes that run half empty.

    Frequently asked questions about ecommerce trends in India for 2027

    What is the market size of ecommerce in India in 2027?

    is the projected size of India's ecommerce market in 2027, according to Mordor Intelligence. That figure covers online goods and services across B2C and B2B. Online retail alone is set to cross $90 billion in 2026, according to Redseer, after growing about 25% in the first half.

    What is the future of e-commerce in India by 2027?

    Indians already shop online, and Bain expects e-retail to grow above 20% a year through 2030. In 2027, growth will lean on smaller cities and Gen Z buyers. Quick commerce will shape how many of them order, with stricter consumer rules in force from January 1.

    What are the new e-commerce rules in India effective January 2027?

    is the new benchmark for discount claims under the Consumer Protection (E-Commerce) (Amendment) Rules, 2026. From January 1, 2027, any announced price cut must show the lowest price of the previous 30 days. Platforms must also label sponsored listings clearly and complete a yearly dark-pattern self-audit.

    How is quick commerce growing in India and what is its market size?

    was India's quick commerce GMV in 2025, about 16% to 17% of e-retail GMV. Quick commerce GMV has doubled every year since 2023. Bain projects $65 to $70 billion by 2030, and Blinkit plans to cross 3,500 dark stores by March 2027.

    What is the CAGR of India's e-commerce market from 2027 to 2032?

    is Mordor Intelligence's projected CAGR for India's ecommerce market from 2027 to 2032, taking it to $378 billion by 2032. B2B is the fastest-growing model, at a projected 16.4% CAGR over the same period. B2C still held 86.22% of market value in 2026.

    How are Tier 2 and Tier 3 cities driving ecommerce growth in India?

    of India's incremental e-retail orders came from Tier 2+ cities in 2025, according to Bain. These cities also supplied about 65% of new online shoppers. On D2C brand websites, Tier 2 and Tier 3 buyers placed about 66% of new orders in FY26.

    What role does ONDC play in India's ecommerce logistics in 2027?

    transactions ran through ONDC in FY2025-26 across commerce and mobility services. For retail sellers, one catalogue can reach several buyer apps, and the network has its own logistics partners for delivery. In 2027, it suits small pilots better than core sales volume.

    What is the D2C market size in India by 2027?

    is the current estimate for India's D2C market, based on Unicommerce data published in April 2026. The same analysis projects $60 billion by 2030. Recent studies have not published a separate 2027 figure, though FY26 order growth of 33% points to a steep climb.

    Conclusion

    India's 2027 ecommerce story is about serving demand at a profit. Shoppers are arriving from smaller cities, and quick commerce is following them there. A stricter compliance baseline also starts on January 1.

    Smaller-city and COD orders fail more often, and each failure costs a large share of the order value. Warehouse supply is growing, though Grade A space in the right corridors stays scarce.

    The operators who gain share in 2027 will be the ones who price returns and compliance into every order before it ships.

    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(); } })();