Menyiapkan TrustArc untuk mendapatkan izin pengguna

Untuk mendapatkan insight berharga sekaligus melindungi privasi pengguna, Anda perlu mengumpulkan izin dari pengguna situs. Sebaiknya gunakan Platform Pengelolaan Izin (CMP) atau gunakan Sistem Pengelolaan Konten (CMS) Anda untuk mengumpulkan izin dan mengirimkannya ke Google.

Langkah 1: Siapkan banner izin

  1. Jika Anda memiliki CCM Advanced (Layanan Terkelola), Technical Account Manager (TAM) akan menyiapkan banner dengan mengikuti persyaratan dan panduan gaya Anda.
  2. Jika Anda memiliki CCM Pro (CMP Layanan Mandiri), TrustArc akan memberi Anda URL untuk login ke portal dan mengonfigurasi banner Anda menggunakan template standar di wizard.
  3. Pastikan banner Anda mematuhi persyaratan dalam Kebijakan Izin Pengguna Uni Eropa (EUUCP) Google. Untuk mengetahui detail selengkapnya tentang penyiapan banner TrustArc, lihat bagian Memulai di Panduan Pengguna kami.
  4. Sertakan elemen <div>, yang bertanggung jawab untuk merender banner dan link CMP, di kode situs Anda atau melalui Google Tag Manager.

Langkah 2: Siapkan mode izin

Menggunakan Google Tag Manager

  1. Buka Tag Manager dan buka penampung Anda.
  2. Di “Tag”, klik Baru, lalu beri nama tag.
  3. Klik Konfigurasi Tag, lalu klik Temukan jenis tag lainnya di Galeri Template Komunitas. Dari galeri, telusuri “TrustArc CMP (Consent Mode)”, lalu instal “TrustArc CMP (Consent Mode)” dari TrustArc.
  4. Konfigurasikan setelan default yang ingin Anda gunakan di bagian “Setelan Mode Izin Default”.
  5. Pilih opsi Deploy CMP Script using the template.
    1. Di kolom CMP ID, masukkan ID instance yang tersedia di Langkah 4. Salin Cuplikan Kode dari portal CCM Pro. Jika Anda memiliki CCM Advanced, TAM dapat memberikan informasi tersebut.
    2. Di kolom Additional parameters, masukkan setelan tambahan untuk instance Anda. Konfigurasi ini digunakan untuk mengganti konfigurasi backend seperti bahasa, deteksi geografis, link kebijakan privasi, dll.
  6. Siapkan Google Consent Mode Integration dengan mengaktifkan opsi Integrate CMP with Google Consent Mode.
  7. Tentukan pemetaan untuk jenis izin dan preferensi pengguna sesuai setelan Anda. Untuk setiap jenis izin yang Anda gunakan, petakan ke ID bucket izin cookie yang sesuai (Required, Functional, Advertising). Di kolom Preferences Cookie, petakan cookie pihak pertama untuk cmapi_cookie_privacy. Di kolom Behavior Cookie, petakan cookie pihak pertama untuk notice_behavior.
  8. Klik Triggering > Consent Initialization - All Pages > Save.
  9. Uji penampung Anda dengan mengklik Preview di sudut kanan atas (lihat petunjuk pengujian di bawah).
  10. Publikasikan penampung Anda.

Menggunakan Platform Lain atau Langsung Mengedit Kode Situs 

  1. Login ke portal TrustArc Support, buka TrustArc Google Consent Mode Implementation Guide dari link ini, lalu ikuti petunjuk di bagian Integrating the Consent Mode Using JavaScript​​.
  2. Jika Anda menggunakan pembuat situs, tinjau dokumentasinya untuk mengetahui cara menerapkan kode dalam tag head di setiap halaman. Jika tidak, lewati ke langkah 3.
  3. Jika Anda menggunakan versi CCM Advanced, ikuti langkah ini. Jika sudah, lewati ke langkah 4. Dalam tag head di setiap halaman (lihat langkah 2 jika Anda menggunakan pembuat situs), salin dan tempel kode di bawah, diikuti dengan skrip CMP yang Anda salin pada langkah 1 di bagian paling atas tag head. Perhatikan bahwa langkah ini sangat penting untuk memastikan CMP berfungsi dengan benar.

    <script>

    window.dataLayer = window.dataLayer || [];

    function gtag(){dataLayer.push(arguments);}

     

    gtag('js', new Date());

    gtag('config', 'AW-YYYYYY');

     

    // Default consent types to 'denied' as a placeholder

    // Determine actual values based on your own requirements

    // Please omit consent types not being used

    gtag('consent', 'default', {

    'ad_storage': 'denied',

    'ad_user_data': 'denied',

    'ad_personalization': 'denied',

    'analytics_storage': 'denied',

    'functionality_storage': 'denied',

    'personalization_storage': 'denied',

    'security_storage': 'denied',

    'wait_for_update': 500

    });

    gtag('set', 'ads_data_redaction', true);

    gtag('set', 'developer_id.dNTIxZG', true);

    </script>

    <!--Banner script here!-->

  4. Jika Anda menggunakan versi CCM Pro, ikuti langkah ini. Dalam tag head di setiap halaman (lihat langkah 2 jika Anda menggunakan pembuat situs), salin dan tempel kode di bawah, diikuti dengan skrip CMP yang Anda salin pada langkah 1 di bagian paling atas tag head. Perhatikan bahwa langkah ini sangat penting untuk memastikan CMP berfungsi dengan benar. Pastikan untuk menyesuaikan pengaitan antara bucket CMP dan jenis izin.

    window.dataLayer = window.dataLayer || [];

    function gtag() { dataLayer.push(arguments); }

    gtag('js', new Date());

    gtag('config', 'GA_MEASUREMENT_ID');

    gtag('set', 'developer_id.dNTIxZG', true);

    // TODO: Can be changed according to customer's need and according to the configuration

    gtag('set', 'ads_data_redaction', true);

    gtag('set', 'url_passthrough', true);

    //Consent Mode Status

    const ConsentType = {

    DENIED: 'denied',

    GRANTED: 'granted',

    };

     

    const convertBooleanToGrantedOrDenied = (boolean) => boolean ? ConsentType.GRANTED : ConsentType.DENIED;

     

    /*

    TODO: This is where you can configure the Google Consent Mode, map the CMP categorisation and the default values for the consent initialization

    Google recommends commenting our consent types that you are not going to use.

    */

    const domain = 'your_domain.com'; // TODO: update

    // Bucket Mapping

    const REQUIRED = 1;

    const FUNCTIONAL = 2;

    const ADVERTISING = 3;

    const consentTypesMapped = {

    'ad_storage': ADVERTISING,

    'ad_user_data': ADVERTISING,

    'ad_personalization': FUNCTIONAL,

    'analytics_storage': FUNCTIONAL,

    'functionality_storage': FUNCTIONAL,

    'personalization_storage': FUNCTIONAL,

    'security_storage': REQUIRED

    }

    const getConsentState = (prefCookie) => {

    var consentStates = {};

    var noticeBehavior = window.truste.util.readCookie("notice_behavior");

    /*

    TODO: Can be changed according to customer's need and according to the configuration

    */

    var impliedLocation = noticeBehavior && noticeBehavior.includes("na");

    for (const consentType in consentTypesMapped) {

    var id = consentTypesMapped[consentType];

     

    if(prefCookie && !prefCookie.includes(0)) {

    console.log("Existing consent..");

    consentStates[consentType] = convertBooleanToGrantedOrDenied(prefCookie && prefCookie.includes(id));

    } else {

    console.log("Non Existing consent..");

    consentStates[consentType] = convertBooleanToGrantedOrDenied(impliedLocation);

    ;}

    ;}

    consentStates['wait_for_update'] = 500;

    console.log(consentStates);

    return consentStates;

    };

    /*

    Helper function to submit a GCM event based on user's preferences on TrustArc's Script

    consent: The consent object will be an array of values [1, 2, 3, n] as 1 being if the user consented to required, 2 to function, ... etc

    This function needs to be customized according to the customer's needed mapping. Ex: 'ad_storage': returnGrantedOrDenied(advertisingAccepted) is being mapped to advertising. if we were to map it to functional instead, we just need to change the bucket variable it's looking at. 

    */

     

    var runOnceGCM = 0;

    function handleConsentDecisionForGCM(consent) {

    //Kode ini menginisialisasi mode izin

    const consentStates = getConsentState(consent.consentDecision);

    var defaultOrUpdate;

    if (runOnceGCM == 0) {

    defaultOrUpdate = 'default';

    runOnceGCM++;

    } else {

    console.log('consent is being updated');

    defaultOrUpdate = 'update';

    }

    console.log(consentStates);

    //Once consent is changed, we will send an update 

    gtag('consent', defaultOrUpdate, {

    consentStates

    });

    }

     

    // This code is responsible for listening to any consent changes trough TrustArc's CCM Instance

    // And pushing the consent changes to the dataLayer according to the customer's consent mapping

    // This is for the intial load. If the user has a consent different from the default values, this is to push an update to the datalayer 

    // Once the CCM loads. 

    var interval = setInterval(() => {

    if (window.truste) {

    var consentDecision = truste.cma.callApi("getGDPRConsentDecision", domain);

    handleConsentDecisionForGCM(consentDecision);

    clearInterval(interval);

    console.log("running once...");

    }

    }, 100);

     

    // Start listening to when users submit their preferences  

    window.addEventListener("message", (event) => {

    let eventDataJson = null;

    // We only care about TrustArc Events at this point. And TrustArc's even it encoded in JSON

    try {

    eventDataJson = JSON.parse(event.data);

    } catch {

    // Some other event that is not JSON. 

    // TrustArc encodes the data as JSON

    // console.log(event.data);

    }

     

    // Safeguard to make sure we are only getting events from TrustArc

    if (eventDataJson && eventDataJson.source === "preference_manager") {

    // Means that the user has submited their preferences

    if (eventDataJson.message === "submit_preferences") {

    console.log("Event Data: ", eventDataJson);

    // Waiting half a second to make sure user's preferences are reflected. 

    setTimeout(() => {

    var consentDecision = truste.cma.callApi("getGDPRConsentDecision", domain);

    console.log("Consent Decision: ", consentDecision);

    handleConsentDecisionForGCM(consentDecision);

    }, 500);

    }

    }

    }, false);

    <!--Banner script here!-->

Melakukan pengujian menggunakan Tag Assistant

Pelajari lebih lanjut cara Memecahkan masalah mode izin dengan Google Tag Manager.

Apakah ini membantu?

Bagaimana cara meningkatkannya?
true
Achieve your advertising goals today!

Attend our Performance Max Masterclass, a livestream workshop session bringing together industry and Google ads PMax experts.

Register now

Telusuri
Hapus penelusuran
Tutup penelusuran
Menu utama
12492162043867898176
true
Pusat Bantuan Penelusuran
true
true
true
true
true
73067
false
false
false