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ÊÓÆµ

Assess Your Post-Purchase Brand Readiness Start Assessment

Home > Blog >

Best Shopify Checkout Upsell Apps to Boost AOV (2027)

Best Shopify Checkout Upsell Apps to Boost AOV (2027)

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 delight customers after checkout?

Trusted by 600+ brands

In this blog

    TL;DR Summary

    • Best for order bumps: AfterSell by Rokt, with checkout bumps and upgrades from $34.99 a month.

    • Best for subscription upgrades: UpsellPlus, $119 a month on its Plus plan.

    • Best for free gifts and trust signals: Checkout Plus, $99 a month for checkout upsells.

    • Best free options: SMART Checkout Upsells & Rules is fully free, and Upsell.com includes checkout offers on its free plan.

    • The Plus rule: Every app here needs Shopify Plus to show offers inside the checkout steps.

    Shopify checkout upsell apps add offers at the moments a customer is most ready to buy more: on the product page, in the cart, inside checkout, and right after payment. The right app lifts average order value from traffic you already have, as long as it fits your Shopify plan and your budget as you grow.

    This guide compares 10 apps on what decides that fit: where each one shows offers, which Shopify plan it needs, how its pricing scales, and how it handles Shopify's August 2026 thank-you page change.

    A quick note on terms

    • Checkout upsell: An offer inside the checkout steps, before payment. Shopify Plus only.

    • Post-purchase upsell: A one-click offer between payment and the thank-you page, accepted without re-entering card details.

    • Order bump: A small add-on in the cart or checkout, such as a warranty or gift wrap.

    What Your Shopify Plan Allows for Checkout Upsells

    Do you need Shopify Plus for checkout upsells?

    It depends on where you want the offer to appear.

    • During checkout: Shopify Plus is required to show upsells on the information, shipping, and payment steps.

    • After checkout: You can show offers on the thank-you and order status pages on Basic, Shopify, and Advanced plans. Starter doesn't support these extensions.

    • On product and cart pages: Upsells are available across plans, depending on the app.

    What changed on August 26, 2026?

    Shopify removed the old thank-you and order status page setup for non-Plus stores. Apps that relied on script tags to display offers on these pages stopped working. Shopify Plus stores went through the same change on August 28, 2025. Apps now need to use Shopify's supported extension framework.

    Which Shopify plan supports which upsell placement?

    Shopify plan Inside checkout Post-purchase page Cart Product page Thank-you and order status
    Basic No Yes Yes Yes Yes
    Shopify No Yes Yes Yes Yes
    Advanced No Yes Yes Yes Yes
    Plus Yes Yes Yes Yes Yes
    • Non-Plus stores: Keep four of five upsell surfaces, including both after-payment placements.

    • Lower risk: After-payment offers can't put the original sale at risk, because the purchase is already complete.

    • The takeaway: Upgrading to Plus only to unlock in-checkout offers rarely pays off by itself. Upgrade for Plus's other benefits, and treat checkout upsells as a bonus.

    Upsell Benchmarks: What the Data Can and Can't Tell You

    There is no reliable industry-wide benchmark for upsell acceptance across apps. However, placement does matter. With , adding another offer before payment introduces friction at an already sensitive stage. Post-purchase offers carry less risk because the original order is confirmed, even if the customer declines the offer.

    Instead of relying on published acceptance rates, compare apps using three metrics: offer acceptance rate, AOV lift, and upsell revenue per order. Together, they show whether an app is generating additional revenue, rather than simply getting customers to accept more offers.

    Top 10 Shopify Checkout Upsell Apps at a Glance

    # App Best for Key checkout feature Starting price Rating
    1 AfterSell by Rokt Order bumps and upgrades Order bumps, upgrades, and reviews $34.99 a month 4.9 (1,139)
    2 UpsellPlus Subscription upgrades One-off to subscription upgrades $119 a month on Plus 5.0 (153)
    3 Checkout Plus Free gifts and social proof Auto-added gifts and trust badges $99 a month for upsells 5.0 (135)
    4 Zipify OCU Paying based on results Upsells billed on upsell revenue Free; paid from $9.95 4.6 (581)
    5 Upsell.com (ex ReConvert) Free checkout carousel Product upsell carousel Free up to 50 orders 4.8 (3,152)
    6 Candy Rack Checkout add-ons Warranties and shipping protection $29.99 a month 5.0 (270)
    7 Selleasy Flat price at scale Flat-rate checkout upsells $29 a month (Pro) 4.9 (2,819)
    8 SMART Checkout Upsells & Rules Free rules and offers Upsells plus payment and shipping rules Free 5.0 (876)
    9 Shopify Checkout Blocks Simple checkout content Content blocks and discounts Free 4.2 (226)
    10 Checkout Components Custom fields and rules Upsells with custom fields $49.99 a month 5.0 (74)

    The 10 Best Shopify Checkout Upsell Apps, Compared

    Each app was evaluated on placements covered, how billing scales, Shopify plan requirements, A/B testing, and AI recommendations. Ratings and prices come from each app's Shopify App Store listing.

    1. AfterSell by Rokt: Best for Checkout Order Bumps and Upgrades

    AfterSell adds order bumps and product upgrades inside checkout. Customers can add them with one tap before they pay. You can also show reviews next to each offer. These checkout offers are included in the $34.99 entry plan.

    • Checkout features: Order bumps, upgrades, and reviews inside checkout

    • 91ÊÓÆµ: $34.99 a month, checkout offers included

    • Rating: 4.9 from 1,139 reviews

    • Pros: Detailed targeting for which customers see each offer, backed by fast, hands-on support

    • Cons: No free plan for live stores

    2. UpsellPlus: Best for Subscription Upgrades in Checkout

    UpsellPlus is built for offers inside checkout. Its main feature lets customers switch a one-time purchase to a subscription before paying, using Recharge, Skio, Appstle, or Smartrr. You can A/B test offers and show them based on what's in the cart. It suits subscription brands on Shopify Plus.

    • Checkout features: Upsells, subscription upgrades, A/B testing, and cart-based display rules

    • 91ÊÓÆµ: $119 a month on the Plus plan, for up to $2,000 in monthly upsell revenue

    • Rating: 5.0 from about 153 reviews

    • Pros: Highly customizable offers, including upsells triggered by specific variants, and a team that builds custom setups on request

    • Cons: $119 a month on the Plus plan, steep for smaller stores

    3. Checkout Plus: Best for Free Gifts and Social Proof at Checkout

    Checkout Plus adds upsells to checkout along with reviews, trust badges, gift messages, and surveys. It can also add a free gift automatically when an order meets your conditions. Checkout upsells and gifts are on the $99 Advanced plan. It suits stores that want offers and trust signals in one app.

    • Checkout features: Upsells, auto-added gifts, reviews, trust badges, gift messages, and surveys

    • 91ÊÓÆµ: $49 a month for checkout customisations; $99 for checkout upsells and gifts

    • Rating: 5.0 from 135 reviews

    • Pros: Flexible custom blocks and conditional logic that can replace several checkout apps

    • Cons: Checkout upsells require the $99 Advanced plan

    4. Zipify OCU: Best for Paying Based on Checkout Results

    Zipify OCU adds upsell offers inside checkout. It charges based on the upsell revenue it brings in, not your order count. Its reports show AOV with and without upsells, so you can see the real lift. A free plan is available to start.

    • Checkout features: Upsell offers inside checkout

    • 91ÊÓÆµ: Free plan; paid from , billed on upsell revenue

    • Rating: 4.6 from 581 reviews

    • Pros: Quick setup with built-in A/B testing and strong training resources

    • Cons: Tracking pixel setup can be difficult

    5. Upsell.com (ex ReConvert): Best Free Checkout Upsell Carousel

    Upsell.com, , adds a product upsell carousel inside checkout. You can target offers by what's in the order and A/B test them. Checkout offers are included on the free plan, so you can test them at no cost.

    • Checkout features: Product upsell carousel with segmentation and A/B testing

    • 91ÊÓÆµ: Free up to 50 orders or $50 in upsell revenue; $9.99 to $39.99 a month up to 500 orders

    • Rating: 4.8 from 3,152 reviews

    • Pros: No-code setup in minutes, with 24/7 hands-on support

    • Cons: Bills on all store orders, not just orders with an upsell

    6. Candy Rack: Best for Checkout Add-Ons

    Candy Rack, made by Digismoothie, adds upsells and add-ons inside checkout. It covers warranties, shipping protection, gift wrap, and priority processing. Its AI mode can choose offers using its own engine or Google Gemini. It doesn't take a share of upsell revenue.

    • Checkout features: Upsells and add-ons like warranties, shipping protection, and gift wrap, with AI-picked offers

    • 91ÊÓÆµ: $29.99 to $59.99 a month up to 500 store orders, with no cut of upsell revenue

    • Rating: 5.0 from 270 reviews

    • Pros: Blends into custom themes through CSS options, with support by phone, chat, and email

    • Cons: A/B testing requires a separate app, Intelligems

    7. Selleasy: Best Flat Price for Checkout Upsells

    Selleasy, made by Logbase, adds upsell offers inside checkout for Plus stores. It charges one flat monthly price, no matter how many orders you ship. That keeps costs predictable as your store grows.

    • Checkout features: Upsell offers inside checkout

    • 91ÊÓÆµ: $15 a month for unlimited orders; $49 for Pro

    • Rating: 4.9 from 2,819 reviews

    • Pros: One flat price for unlimited orders, the lowest checkout upsell cost at high volume

    • Cons: AI recommendations are capped by plan

    8. SMART Checkout Upsells & Rules: Best Free App for Checkout Rules and Offers

    SMART Checkout adds upsells, banners, and discount codes to checkout. It also lets you validate orders and hide, sort, or rename payment and shipping methods based on country, cart value, or customer tag. The app is free.

    • Checkout features: Upsells, banners, discount codes, order validation, and payment and shipping rules

    • 91ÊÓÆµ: Free

    • Rating: 5.0 from 876 reviews

    • Pros: Full control over payment, shipping, and order rules, plus upsells, without paying anything

    • Cons: Upsell features are basic compared with dedicated upsell apps

    9. Shopify Checkout Blocks: Best for Simple Checkout Content

    Checkout Blocks is Shopify's own free app for customizing checkout. Plus stores can add content blocks, custom fields, and order or shipping discounts. It can also hide, rename, or reorder delivery and payment methods. Offers are set up by hand, since it doesn't recommend products.

    • Checkout features: Content blocks, custom fields, discounts, and delivery and payment method controls

    • 91ÊÓÆµ: Free

    • Rating: 4.2 from 226 reviews

    • Pros: Free and made by Shopify, so there's no third-party app to manage

    • Cons: No product recommendations or upsell analytics

    10. Checkout Components: Best for Custom Fields and Rules Alongside Upsells

    Checkout Components adds upsells inside checkout, together with content blocks, custom fields, and display rules. You can collect extra information from customers and control when each offer appears. It suits Plus stores that want to customize checkout and upsell from the same app.

    • Checkout features: Upsells, content blocks, custom fields, and rules

    • 91ÊÓÆµ: From $49.99 a month, with a free trial

    • Rating: 5.0 from 74 reviews

    • Pros: Upsells, blocks, fields, and rules in one checkout app

    • Cons: No free plan, starting at $49.99 a month

    What These Apps Really Cost as You Grow

    The pricing model matters more than the sticker price, because it decides how your bill moves as you grow. These apps bill on one of three things:

    • Store orders: The bill rises with every order you ship, even if upsells don't improve.

    • Upsell revenue: The bill rises only when the app earns more, which feels fair but grows with success.

    • Flat: One price at any volume, the most predictable at scale.

    App What drives the bill Monthly price at 500 orders
    AfterSell Plan tier $34.99
    UpsellPlus Upsell revenue $119 on the Plus plan
    Checkout Plus Plan tier $99 for checkout upsells
    Zipify OCU Upsell revenue From $9.95, rising with upsell revenue
    Upsell.com Store orders or upsell revenue $39.99
    Candy Rack Store orders $59.99
    Selleasy Flat $29
    SMART Checkout Upsells & Rules Free $0
    Shopify Checkout Blocks Free $0
    Checkout Components Plan tier From $49.99

    Several listings only publish tiers up to 500 orders. Above that, check each app's pricing page before you commit. A flat $29 plan still costs $29 at 10,000 orders. An order-based plan at the same volume can cost many times more, so model your next year's volume, not just this month's.

    Where ClickPost Fits: Upsells While Customers Edit Their Orders

    ClickPost takes a different approach to upselling with , focusing on customers who want to modify their orders after checkout.It doesn't place offers inside the checkout steps. It works on the thank-you and order status pages, where customers can update their address, change variants or quantities, add or replace items, apply discounts, or cancel, and see upsells while they do it. Those pages are available on every Shopify plan except Starter, so it doesn't need Plus.

    • Upsells: Thank-you page, order status page, and post-purchase offers, including subscription upsells, AI recommendations, frequently bought together, free gifts, and product add-ons

    • Order edits: Address, variants, quantity, added or replaced items, discounts, and cancellations with automatic refunds or store credit

    • Address validation: Google Maps flags bad shipping addresses before the order ships

    • 91ÊÓÆµ: Free under 500 orders a month (25 edits, then $1 each); $49 for 500 to 5,000 orders; $129 for 5,000 to 15,000; $199 above that

    A checkout upsell app sells before payment. ClickPost sells when a customer comes back to change their order, before it ships. A customer who returns to switch to a bigger size can add matching socks in the same step, so the two apps cover different moments and don't compete.

    How to Choose the Right Upsell App in 5 Steps

    1. Confirm you're on Shopify Plus. Offers inside checkout need Plus. If you're not on Plus, use thank-you, order status, or post-purchase offers instead.

    2. Pick your main checkout offer. Order bumps: AfterSell. Subscription upgrades: UpsellPlus. Add-ons like warranties: Candy Rack. Free gifts and trust badges: Checkout Plus.

    3. Choose a pricing model. Flat: Selleasy. Plan tier: AfterSell, Checkout Plus, or Checkout Components. Upsell revenue: Zipify OCU or UpsellPlus. Free: SMART Checkout or Checkout Blocks.

    4. Check it uses Shopify's checkout extensions. Look for "Checkout" under "Works with" on the App Store listing.

    5. Test before you commit. Use the free plan or trial, then compare acceptance rate and AOV lift on real orders.

    The Verdict

    The best checkout upsell app is the one that fits the offer you want to run, on a pricing model that still works at next year's volume.

    • Order bumps and upgrades: AfterSell

    • Subscription upgrades: UpsellPlus

    • Add-ons like warranties and shipping protection: Candy Rack

    • Free gifts and trust badges: Checkout Plus

    • Starting free: SMART Checkout or Upsell.com

    • Not on Plus: In-checkout offers aren't available, so use thank-you, order status, and post-purchase offers instead

    This category changes quickly, so we'll update this list as pricing and features change. Once checkout is covered, one moment is still open: the customer who comes back to edit their order. That's where ClickPost works.

    FAQs: Shopify Checkout Upsell Apps

    What is the best checkout upsell app for Shopify?

    AfterSell is the best all-round pick, with order bumps and upgrades inside checkout on its $34.99 entry plan. Subscription brands should look at UpsellPlus, and stores that want to start free should try SMART Checkout or Upsell.com.

    Do I need Shopify Plus for checkout upsells?

    Yes, for offers inside the checkout steps. Offers on the thank-you and order status pages work on every plan except Starter.

    Can you do checkout upsells without Shopify Plus?

    Not inside checkout itself. You can still upsell on the product page, in the cart, on the post-purchase page, and on the thank-you and order status pages.

    What's the difference between a post-purchase upsell and a checkout upsell?

    A checkout upsell appears before the customer pays. A post-purchase upsell appears after payment, so it can't cost you the original sale.

    How much do Shopify checkout upsell apps cost?

    From free to about $120 a month for the apps here. SMART Checkout and Shopify Checkout Blocks are free, Selleasy is a flat $29 a month, and UpsellPlus costs $119 a month on its Plus plan.

    What is the best free checkout upsell app?

    SMART Checkout Upsells & Rules is fully free and adds upsells and checkout rules. Upsell.com includes checkout offers on its free plan, up to 50 orders a month.

    What is the best upsell app for Shopify Plus?

    AfterSell for order bumps and upgrades, UpsellPlus for subscription upgrades, and Checkout Plus for free gifts and trust badges.

    How do I switch checkout upsell apps without breaking offers?

    Set up your offers in the new app during its trial and add its block in Shopify's checkout editor. Then remove the old app's block before you uninstall it, so checkout never shows an empty slot.

    Which checkout upsell apps work after the August 2026 change?

    Apps that list "Checkout" under "Works with" on the App Store use Shopify's extension framework. Checkout Plus, SMART Checkout, and Candy Rack all do.

    How We Evaluate Apps

    ClickPost's editorial team compares software using each vendor's public pricing, Shopify App Store listing, and official documentation, checked on the date stated in the article. Where a claim can't be confirmed, we say so. When a product we compare is our own, we disclose it and show the facts behind its placement. We update comparisons when pricing or features change.

    The Post-Purchase Experience Platform

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