Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Trang này dành cho những nhà phát triển duy trì giải pháp yêu cầu sự đồng ý của riêng họ trên trang web và muốn tích hợp chế độ đồng ý. Để biết thông tin giới thiệu về chế độ đồng ý, hãy đọc bài viết Tổng quan về chế độ đồng ý. Nếu bạn sử dụng Nền tảng quản lý sự đồng ý (CMP) để lấy sự đồng ý của người dùng, hãy tìm hiểu thêm về cách thiết lập chế độ đồng ý bằng CMP.
Bạn có thể triển khai chế độ đồng ý theo cách cơ bản hoặc nâng cao. Hãy kiểm tra nguyên tắc của công ty để chọn phương thức triển khai và phương thức mặc định cần đặt. Tìm hiểu thêm về chế độ đồng ý cơ bản và nâng cao.
Trước khi bắt đầu
Hãy cân nhắc những điều sau trước khi triển khai chế độ đồng ý:
Nếu bạn sử dụng Trình quản lý thẻ và muốn duy trì biểu ngữ của riêng mình, bạn nên tải biểu ngữ thông qua vùng chứa Trình quản lý thẻ. Để làm như vậy, bạn cần tạo mẫu chế độ đồng ý. Ngoài ra, bạn có thể sử dụng mẫu chế độ đồng ý trong Thư viện mẫu cho cộng đồng.
Nếu bạn sử dụng gtag.js, hãy đảm bảo bạn đã cài đặt thẻ Google trên mọi trang của trang web. Mã chế độ đồng ý sẽ được thêm vào từng trang của trang web.
[null,null,["Cập nhật lần gần đây nhất: 2024-11-22 UTC."],[[["\u003cp\u003eThis guide explains how to integrate Google's consent mode for developers managing their own website consent solution.\u003c/p\u003e\n"],["\u003cp\u003eConsent mode allows you to control data collection based on user consent for advertising and analytics purposes.\u003c/p\u003e\n"],["\u003cp\u003eYou need to set the default consent state and update it based on user interactions with your consent settings.\u003c/p\u003e\n"],["\u003cp\u003eConsent mode was recently updated and now includes additional parameters for advertising user data and personalization.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers using legacy tags are encouraged to update to gtag.js or Google Tag Manager for better privacy controls.\u003c/p\u003e\n"]]],["Developers implementing their own consent solution should set up consent mode by first defining the default consent state before user interaction. They should then update the consent state based on user choices, ensuring updates are tracked before any page transitions. Consent mode has been updated to include `ad_user_data` and `ad_personalization` parameters. Users with older consent mode versions need to upgrade to v2. Legacy tags should be updated to gtag.js or Google Tag Manager.\n"],null,["# Set up consent mode on websites\n\n\u003e This page is for developers who maintain their own consent solution on their\n\u003e website and want to integrate consent mode. For an introduction to consent mode,\n\u003e read [Consent mode overview](/tag-platform/devguides/privacy#consent_mode_overview). If you use a Consent Management Platform (CMP)\n\u003e to obtain user consent, learn more about [how to set up consent mode with a CMP](https://support.google.com/tagmanager/answer/14009343#web-consent).\n\nYou can implement consent mode in a basic or advanced way. Check your company's\nguidelines to pick an implementation method and which defaults to set. Learn\nmore about [basic versus advanced consent mode](/tag-platform/security/concepts/consent-mode#basic-vs-advanced).\n|\n| **Important** : Consent mode was updated in November, 2023 and\n| now contains two additional parameters. If you already use consent mode,\n| [upgrade to consent mode v2](#upgrade-consent-v2).\n|\n|\nLearn more about [Updates to consent mode for traffic in European Economic Area (EEA)](https://support.google.com/tagmanager/answer/13695607). \nAdvanced consent mode Basic consent mode\n\nBefore you begin\n----------------\n\nTake the following into consideration before implementing consent mode:\n\n- If you use Tag Manager and want to maintain your own banner, the recommended\n approach is loading your banner through the Tag Manager container. To do so,\n you need to [create a consent mode template](https://developers.google.com/tag-platform/tag-manager/templates/consent-apis). Alternatively, you can use a\n consent mode template from the [Community Template Gallery](https://tagmanager.google.com/gallery/#/?filter=consent&page=1).\n\n- If you use gtag.js, make sure you have installed the Google tag on every\n page of your website. The consent mode code gets added to each page of your\n website.\n\nSet up consent mode\n-------------------\n\nTo set up consent mode, you need to:\n\n1. Before a user grants consent: [Set the default\n consent state](#default-consent).\n2. [Update the consent state](#update-consent) based on the user interaction with your consent settings.\n\n\u003cbr /\u003e\n\n|\n| **Important** : Make sure that consent updates are tracked on the\n| page where they occur, before any page transition.\n|\n|\n| The Google tag takes actions (e.g. writing cookies, sending events) in\n| response to the command to ensure future events will include the full\n| measurement data.\n\nUpgrade to consent mode v2\n--------------------------\n\nAs a part of Google's ongoing commitment to a privacy-centric digital\nadvertising ecosystem, we are strengthening the enforcement of our [EU user\nconsent policy](https://www.google.com/about/company/user-consent-policy/).\n\nLearn more about Google's [Updates to consent mode for traffic in European\nEconomic Area (EEA)](https://support.google.com/tagmanager/answer/13695607).\n\nConsent mode users need to send two new parameters in addition to `ad_storage`\nand `analytics_storage`:\n\n| Field Name | Allowed Values | Description |\n|------------------------|--------------------------|----------------------------------------------------------------------|\n| ` ad_user_data ` | ` 'granted' | 'denied' ` | Sets consent for sending user data related to advertising to Google. |\n| ` ad_personalization ` | ` 'granted' | 'denied' ` | Sets consent for personalized advertising. |\n\nNext steps\n----------\n\n- [Verify consent mode works](/tag-platform/devguides/consent-debugging#start-debugging)\n\nLegacy tag controls\n-------------------\n\nIf you use legacy tags, such as ga.js, analytics.js, or conversion.js, update to\ngtag.js or Google Tag Manager.\n\nTo learn more about other legacy tag's privacy controls, see the following\ndocumentation:\n\n- [Google Analytics](https://support.google.com/analytics/answer/9019185)\n- [Google Ads](https://support.google.com/google-ads/answer/9606827)\n- [Campaign Manager](https://support.google.com/campaignmanager/topic/6228828)\n\nRelated links\n-------------\n\n- [Tag Manager consent APIs](/tag-platform/tag-manager/templates/consent-apis)\n- [Google tag consent APIs](/tag-platform/gtagjs/reference)\n- [Create a consent mode template](https://developers.google.com/tag-platform/tag-manager/templates/consent-apis)\n- [Community Template Gallery](https://tagmanager.google.com/gallery/#/?filter=consent&page=1)\n- [Tag consent configuration](https://support.google.com/tagmanager/answer/10718549)"]]