AI Cookie橫幅產生器。

描述您需要的Cookie同意體驗 — 橫幅樣式、按鈕標籤、法律文案、配色方案 — MeDo即刻產生生產就緒的程式碼。無需範本即可發佈合規的、符合品牌的Cookie橫幅。

Cookie橫幅
Cookie橫幅

Cookie橫幅是法律要求的 — 而且通常做得很差。

GDPR、CCPA和ePrivacy法規要求在設定非必要Cookie之前取得知情同意,監管機構正在積極執法。但大多數Cookie橫幅使用暗模式、醜陋或有缺陷。一個設計良好的同意橫幅能建立用戶信任、減少侵入性彈窗造成的跳出,並在不犧牲體驗的情況下保持網站合規。MeDo幫助您產生一個看起來是精心設計的橫幅,而不是臨時拼湊的。

6 個模板

可以產生的 Cookie橫幅 模板

每個模板都是真實的提示詞,而非截圖。複製到任何 AI 編輯器,或在 MeDo 中執行,直接取得 React + Tailwind 程式碼。

Bottom barBaseline

Accept and Reject Bottom Bar

One line of copy, two buttons of equal weight, a policy link. The smallest banner that still gives a genuine choice rather than a dismiss disguised as one.

Create a cookie consent bar fixed to the bottom of the viewport: a short line explaining that non-essential cookies are used for analytics, a link to the cookie policy, and two buttons — Accept all and Reject non-essential — rendered with identical size, contrast and padding so neither is visually demoted. Render it in a region with role="region" and an accessible name, do not trap focus, and place it last in the DOM so it does not sit ahead of the page content in tab order. Persist the decision under a versioned key in localStorage with a timestamp, and keep the bar hidden on every later visit until that version changes. Load no analytics script before a decision exists.

在 MeDo 中試試
CategoriesGranular

Per-Category Consent Panel

Four categories, three of them off until someone turns them on. The version to build when tags actually differ in purpose rather than all being one analytics script.

Create a cookie consent panel with four categories: Necessary (locked on, with a note explaining it cannot be disabled), Functional, Analytics and Marketing, each a labelled switch with a one-sentence description of what it enables. Every non-essential switch defaults to off. Provide Accept all, Reject all and Save preferences, with Accept all and Reject all identical in weight. Store the result as an object keyed by category alongside a schema version and timestamp, and emit a consent-changed event so tag loading can react without a page reload. Keep the switches keyboard operable with visible focus rings and expose state through aria-checked rather than colour alone.

在 MeDo 中試試
ModalGate

Centered Consent Modal

Blocks the page until a choice is made. Highest completion rate, highest bounce rate — reach for it only when a decision genuinely has to precede the first render.

Create a centered cookie consent modal with a dimmed backdrop: heading, two sentences of explanation, a cookie policy link, and Accept all, Reject all and Manage preferences buttons with the first two given equal visual weight. Use role="dialog" with aria-modal="true", label it by its heading, move focus to the heading on open, cycle Tab within the dialog, and do not close on Escape or backdrop click since either would leave consent undecided. Persist the choice in a versioned localStorage record with a timestamp and render nothing on subsequent visits. Do not pre-tick any non-essential category, and gate every non-essential script behind the stored value.

在 MeDo 中試試
ToastCorner

Corner Card Consent Toast

A small card in the bottom corner that leaves the page usable. Least disruptive and least answered — expect a large share of visitors to simply ignore it.

Create a cookie consent card anchored to the bottom-left corner, roughly 360px wide, with a cookie icon, a two-line explanation, a policy link and stacked Accept all and Reject all buttons of matching width and contrast. It must not overlap other fixed UI, so offset it above any support launcher. Do not include a bare X dismiss control — a close button that leaves consent unrecorded means the banner returns on every navigation. Render it after the main landmark in the DOM, keep it out of any focus trap, and persist the decision in a versioned localStorage entry with a timestamp so it stays hidden once answered.

在 MeDo 中試試
Persistent accessReopen

Banner With a Preferences Trigger

The banner plus a permanent footer link that reopens it. Consent that cannot be changed later is the most common defect in a shipped banner, and the fix is one link.

Create a cookie consent bar plus a persistent Cookie preferences button for the site footer that reopens the same panel with the stored values pre-loaded, so a visitor can withdraw consent as easily as they gave it. The panel lists Necessary, Functional, Analytics and Marketing switches with non-essential ones reflecting whatever was saved, and offers Accept all, Reject all and Save preferences. On reopen, move focus to the panel heading and return focus to the footer button on close. Write changes to the same versioned localStorage key with a fresh timestamp and emit a consent-changed event so already-loaded tags can be told to stop.

在 MeDo 中試試
Geo-awareRegional

Region-Conditional Consent Banner

Shows the full category panel where prior consent is expected and a lighter notice elsewhere, driven by a server-supplied region hint. The requirements vary by jurisdiction, so confirm the rules for each region with counsel.

Create a consent component that takes a region prop resolved server-side from the request and renders one of two variants: a full category panel with all non-essential switches defaulting to off and Accept all, Reject all and Save preferences of equal weight, or a lighter notice with an acknowledge action and a link to a cookie settings page. Never pre-tick a non-essential category in either variant. Store the decision with the region and a schema version so the record explains which variant produced it, and re-prompt when the version changes. Keep the region check server-side so no tracking script loads before the variant is known.

在 MeDo 中試試

如何自訂你的 Cookie橫幅

配合您的網站設計系統

在提示詞中指定品牌顏色、圓角和字型,使橫幅看起來像原生元件 — 而非第三方外掛。用戶更願意與看起來屬於網站的橫幅互動。

選擇橫幅位置和動畫

底部欄、置中彈窗和角落吐司是三種主要模式。告訴MeDo您的偏好以及您想要上滑、淡入還是即時出現。底部欄最不打擾;彈窗對嚴格法域最合規。

調整按鈕層級

暗模式(隱藏拒絕按鈕)會引來監管罰款。要求MeDo給「接受」和「拒絕」同等的視覺權重,或使用中立的「管理偏好設定」CTA引導到細粒度同意彈窗。

新增偏好設定面板

為了更完善的合規性,要求MeDo包含一個可切換的偏好設定面板,帶有分類開關(分析、行銷、功能性)。這是GDPR合規和用戶信任的黃金標準。

誰在使用 Cookie橫幅 組件

SaaS產品

帶有接受/拒絕和Cookie政策連結的輕量底部橫幅。不打擾但合規 — 在滿足GDPR義務的同時保持應用介面為焦點。

電商店舖

帶有偏好設定彈窗的完整同意橫幅,覆蓋分析、個人化和行銷Cookie。對使用廣告像素和再行銷的店舖至關重要。

行銷或部落格網站

帶有單個「接受」按鈕和Cookie設定文字連結的簡單Cookie通知。為僅有分析Cookie的內容優先網站提供最小摩擦。

企業或受監管行業

帶有供應商級別開關、完整的同意決策稽核日誌和突出「全部拒絕」選項的細粒度同意彈窗 — 為滿足嚴格的DPA要求而建構。

不同網站的 Cookie橫幅 方案

同一個 cookie橫幅 組件,針對它所在網站的類型作調整。

01 / 06

SaaS Product Consent

A bottom bar with equal-weight accept and reject, and the reject path wired to skip product analytics rather than just hiding the bar. The failure here is a banner on the marketing site and none inside the authenticated app, where most of the event tracking actually happens.

Cookie橫幅 的風格與變體

挑選與頁面其餘部分相襯的變體,然後產生它。

01 / 06

Bottom Bar Banner

Full-width strip pinned to the bottom, one line of copy, two buttons. The least disruptive pattern and the safest default. Watch the mobile height — a three-line bar covering a sticky Add to cart button is a conversion bug, not a design detail.

在 React、Next.js、Vue 與 Svelte 中使用 Cookie橫幅

React、Next.js、Vue 3、SvelteKit、Astro 或純 HTML —— 同一個 cookie橫幅,六種接入方式。

01 / 06

React Cookie Banner

Consent belongs in a context provider at the app root, not in the banner — the banner is one reader of that state and every gated feature is another. Read localStorage in an effect so the first render matches the server.

src/components/ConsentProvider.tsx

const KEY = 'consent.v2'

export function ConsentProvider({ children }) {
  const [consent, setConsent] = useState(null)

  useEffect(() => {
    setConsent(JSON.parse(localStorage.getItem(KEY) ?? 'null'))
  }, [])

  return (
    <Ctx.Provider value={{ consent, setConsent }}>{children}</Ctx.Provider>
  )
}

如何把 Cookie橫幅 加入專案

四個步驟,從挑選 cookie橫幅 模板到推上生產環境。

01~30s

Pick a Consent Pattern

Choose by how many distinct cookie purposes you actually have — a bottom bar for one analytics script, a category panel once marketing and functional tags are separate concerns.

02~10s

Copy the Prompt

Paste it into MeDo, Lovable, Bolt, v0 or Cursor. Replace the category descriptions with the tags you really run, since that list is what your policy page has to agree with.

03~1min

Generate and Refine

You get React + Tailwind with a live preview. Follow up in plain English — "give reject all the same weight as accept", "expand preferences in place", "add a footer trigger that reopens it".

04~2min

Gate Your Scripts and Verify

Wire analytics and pixel loading to the stored value, then load the site fresh and confirm no non-essential request fires before a choice. Specific consent obligations vary by jurisdiction — have counsel review what you ship.

關於 Cookie橫幅 的常見問題

如何用AI建立Cookie橫幅?

在MeDo中,描述您需要的Cookie同意橫幅 — 位置、按鈕標籤、使用的Cookie和視覺風格。MeDo產生完整的元件程式碼,您可以複製到專案中或透過後續提示詞繼續完善。無需搜尋範本。

最好的AI Cookie橫幅產生器是什麼?

MeDo專為產生生產就緒的網站元件而建構,包括Cookie橫幅。與通用AI工具不同,MeDo輸出具有無障礙標記和合理GDPR合規標籤預設值的乾淨語義程式碼 — 而非需要修復的粗糙範本。

AI能產生符合GDPR的Cookie橫幅嗎?

MeDo能產生遵循GDPR最佳實踐模式的Cookie橫幅:同等權重的接受/拒絕按鈕、Cookie政策連結和可選的分類同意開關。但真正的法律合規取決於您的具體資料實踐和管轄權 — 請務必讓法務團隊審核最終實現。

如何在Cookie橫幅中新增「全部拒絕」按鈕?

只需在提示詞中包含它 — 例如,「新增一個與接受按鈕同等視覺權重的全部拒絕按鈕」。MeDo將產生具有匹配樣式的兩個按鈕,並連接適當的邏輯佔位符。

能用AI產生Cookie偏好設定彈窗嗎?

可以。要求MeDo包含帶有分類開關的偏好設定面板(如分析、行銷、功能性Cookie)。MeDo將產生帶有切換開關、分類描述和儲存/確認操作的完整彈窗。

AI Cookie橫幅能配合Google Analytics和Meta Pixel使用嗎?

MeDo產生UI和同意閘控邏輯。您可以要求它包含根據用戶同意阻止或載入分析指令碼的佔位符鉤子。將其連接到您特定的標籤管理器或分析SDK需要產生後的一個小整合步驟。