custom/apps/xxx21LuigisBoxExtension/Resources/views/storefront/component/analytics.html.twig line 1

Open in your IDE?
  1. {% sw_extends '@Storefront/storefront/component/analytics.html.twig' %}
  2. {% block component_head_analytics %}
  3.     {{ parent() }}
  4.   <script>var LuigisBoxAppVersion = "1.2.5"</script>
  5.     <script>var ruleIds = {{(context.getRuleIds|json_encode|raw)}}</script>
  6.     <script>var displayNet = !{{(context.getCurrentCustomerGroup.getDisplayGross|json_encode)}}</script>
  7.   {% set oldKey = "LuigisBox.config.#{(context.getLanguageId)}" %}
  8.   {% set newKey = "LuigisBox.config.#{(context.getSalesChannelId)}.#{(context.getLanguageId)}" %}
  9.   {% set configValue = config(oldKey) ?: config(newKey) %}
  10.     <script async src="{{ configValue }}"></script>
  11.     <script>
  12.       function eventCallback(updatedCookies) {
  13.             if (typeof updatedCookies.detail['_lb_id'] !== 'undefined' && typeof updatedCookies.detail['_lb_ccc'] !== 'undefined') {
  14.               // The cookie with the cookie attribute "_lb_id" and "_lb_ccc" either is set active or from active to inactive
  15.               let iDCookieActive = updatedCookies.detail['_lb_id'];
  16.               let consentCookieActive = updatedCookies.detail['_lb_ccc'];
  17.               if (iDCookieActive && consentCookieActive) {
  18.                 document.cookie = "lbx_consent_cookie=true";
  19.               } else {
  20.                 document.cookie = "lbx_consent_cookie=false";
  21.               }
  22.             } else if (typeof updatedCookies.detail['_lb_id'] !== 'undefined') {
  23.               // The cookie with the cookie attribute "_lb_id" was updated but "_lb_ccc" was not
  24.               let iDCookieActive = updatedCookies.detail['_lb_id'];
  25.               if (!iDCookieActive) {
  26.                 document.cookie = "lbx_consent_cookie=false";
  27.               }
  28.             }
  29.       }
  30.           function registerCallback(){
  31.         if(!document.$emitter){
  32.           setTimeout(registerCallback, 200);
  33.           return;
  34.         }
  35.         
  36.         document.$emitter.subscribe('CookieConfiguration_Update', eventCallback);
  37.           }
  38.           registerCallback();
  39.       </script>
  40. {% endblock %}