package: consentfriend
services:
  - name: googleAnalytics
    title: ''
    description: ''
    code: |
      <script async src="https://www.googletagmanager.com/gtag/js?id=[[++google_analytics_id]]"></script>
      <script>
        window.dataLayer = window.dataLayer || [];
        function gtag(){dataLayer.push(arguments);}
        gtag('js', new Date());
        
        gtag('config', '[[++google_analytics_id]]');
      </script>
    code_section: 0
    callback: ''
    on_accept: |
      function (opts) {
          console.log('accept');
          window.dataLayer = window.dataLayer || [];
          window.gtag = function(){
              dataLayer.push(arguments);
          }
          gtag('consent', 'update', {'ad_storage': 'denied', 'ad_user_data': 'denied', 'ad_personalization': 'denied', 'analytics_storage': 'granted'});
      }
    on_init: |
      function (opts) {
          console.log('init');
          window.dataLayer = window.dataLayer || [];
          window.gtag = function(){
              dataLayer.push(arguments);
          }
          gtag('consent', 'default', {'ad_storage': 'denied', 'ad_user_data': 'denied', 'ad_personalization': 'denied', 'analytics_storage': 'denied'});
      }
    on_decline: |
      function (opts) {
          console.log('decline');
          window.dataLayer = window.dataLayer || [];
          window.gtag = function(){
              dataLayer.push(arguments);
          }
          gtag('consent', 'update', {'ad_storage': 'denied', 'ad_user_data': 'denied', 'ad_personalization': 'denied', 'analytics_storage': 'denied'});
      }
    active: false
    default: false
    required: false
    opt_out: false
    only_once: true
    contextual_consent_only: false
    cookies:
      - cookie: _ga
        path: ''
        domain: ''
      - cookie: '/^_ga.*$/'
        path: ''
        domain: ''
    purposes: performance
