templates/front/base/didomi_scripts.html.twig line 1

Open in your IDE?
  1. {# Didomi load #}
  2. <script type="text/javascript">
  3.     (function(){function r(e){if(!window.frames[e]){if(document.body&&document.body.firstChild){var t=document.body;var n=document.createElement("iframe");n.style.display="none";n.name=e;n.title=e;t.insertBefore(n,t.firstChild)}else{setTimeout(function(){r(e)},5)}}}function e(n,a,o,c,d){function e(e,t,n,r){if(typeof n!=="function"){return}if(!window[a]){window[a]=[]}var i=false;if(d){i=d(e,r,n)}if(!i){window[a].push({command:e,version:t,callback:n,parameter:r})}}e.stub=true;e.stubVersion=2;function t(r){if(!window[n]||window[n].stub!==true){return}if(!r.data){return}var i=typeof r.data==="string";var e;try{e=i?JSON.parse(r.data):r.data}catch(t){return}if(e[o]){var a=e[o];window[n](a.command,a.version,function(e,t){var n={};n[c]={returnValue:e,success:t,callId:a.callId};if(r.source){r.source.postMessage(i?JSON.stringify(n):n,"*")}},a.parameter)}}if(typeof window[n]!=="function"){window[n]=e;if(window.addEventListener){window.addEventListener("message",t,false)}else{window.attachEvent("onmessage",t)}}}e("__tcfapi","__tcfapiBuffer","__tcfapiCall","__tcfapiReturn");r("__tcfapiLocator");(function(e,t){var n=document.createElement("link");n.rel="preconnect";n.as="script";var r=document.createElement("link");r.rel="dns-prefetch";r.as="script";var i=document.createElement("script");i.id="spcloader";i.type="text/javascript";i["async"]=true;i.charset="utf-8";var a="https://sdk.privacy-center.org/"+e+"/loader.js?target_type=notice&target="+t;if(window.didomiConfig&&window.didomiConfig.user){var o=window.didomiConfig.user;var c=o.country;var d=o.region;if(c){a=a+"&country="+c;if(d){a=a+"&region="+d}}}n.href="https://sdk.privacy-center.org/";r.href="https://sdk.privacy-center.org/";i.src=a;var s=document.getElementsByTagName("script")[0];s.parentNode.insertBefore(n,s);s.parentNode.insertBefore(r,s);s.parentNode.insertBefore(i,s)})("bfc35b77-8af5-4636-a7bd-d5c132888e64","RQ7UmmaZ")})();
  4. </script>
  5. <script type="didomi/javascript" data-vendor="posthog-LU94YpzD">
  6.     !function(t,e){var o,n,p,r;e.__SV||(window.posthog=e,e._i=[],e.init=function(i,s,a){function g(t,e){var o=e.split(".");2==o.length&&(t=t[o[0]],e=o[1]),t[e]=function(){t.push([e].concat(Array.prototype.slice.call(arguments,0)))}}(p=t.createElement("script")).type="text/javascript",p.async=!0,p.src=s.api_host+"/static/array.js",(r=t.getElementsByTagName("script")[0]).parentNode.insertBefore(p,r);var u=e;for(void 0!==a?u=e[a]=[]:a="posthog",u.people=u.people||[],u.toString=function(t){var e="posthog";return"posthog"!==a&&(e+="."+a),t||(e+=" (stub)"),e},u.people.toString=function(){return u.toString(1)+".people (stub)"},o="capture identify alias people.set people.set_once set_config register register_once unregister opt_out_capturing has_opted_out_capturing opt_in_capturing reset isFeatureEnabled onFeatureFlags getFeatureFlag getFeatureFlagPayload reloadFeatureFlags group updateEarlyAccessFeatureEnrollment getEarlyAccessFeatures getActiveMatchingSurveys getSurveys onSessionId".split(" "),n=0;n<o.length;n++)g(u,o[n]);e._i.push([i,s,a])},e.__SV=1)}(document,window.posthog||[]);
  7.     posthog.init('phc_a7owjkq1CQFyyQFwEVz8P7wf3pMGLgxxiB8R5hkGUmC',{api_host:'https://eu.posthog.com'})
  8.     if ('{{ posthogData.customerId }}') {
  9.         posthog.identify(
  10.             '{{ posthogData.customerId }}',
  11.             { email: '{{ posthogData.email }}', user_type: '{{ posthogData.hasPack }}' === "1" ? "client" : "lead"  }
  12.         );
  13.     }
  14.     const elements = document.getElementsByClassName("posthogProductType");
  15.     Array.from(elements).forEach(function(element) {
  16.         element.addEventListener('click', ()=> {
  17.             // eslint-disable-next-line no-undef
  18.             if (typeof posthog !== 'undefined' && posthog && product?.id_product) {
  19.                 // eslint-disable-next-line no-undef
  20.                 posthog.capture('productType_clicked', {
  21.                     id_product: product.id_product,
  22.                 });
  23.             }
  24.         });
  25.     });
  26. </script>
  27. <script type="didomi/javascript" data-vendor="googleana-4TXnJigR">
  28.     (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
  29.             new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
  30.         j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
  31.         'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
  32.     })(window,document,'script','dataLayer','GTM-PZVKJ7V');
  33.     var dataLayer = dataLayer || null;
  34.     if (dataLayer  !== null ) {
  35.         dataLayer.push({
  36.             event: 'page_userid',
  37.             pageName: '{{ dataLayerUserData.pageName }}',
  38.             user_id: '{{ dataLayerUserData.userId }}'
  39.         });
  40.     }
  41. </script>
  42. <noscript type="didomi/javascript" data-vendor="googleana-4TXnJigR"><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-PZVKJ7V" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
  43. {# Hubspot #}
  44. <script type="didomi/javascript" data-vendor="hubspot" id="hs-script-loader" async defer src="//js.hs-scripts.com/4815104.js"></script>
  45. <script type="didomi/javascript" data-vendor="hubspot">
  46.         {% set userEmail = '' %}
  47.         {% set userId = '' %}
  48.         {% if app.user.email is defined %}
  49.             {% set userEmail = app.user.email %}
  50.             {% set userId = app.user.id %}
  51.         {% endif %}
  52.         window.addEventListener("load", (event) => {
  53.             window.hsConversationsSettings = {
  54.                 identificationEmail: "{{ userEmail }}",
  55.                 identificationToken: getCookie('token_chat_hubspot')
  56.             };  
  57.             var _hsq = (window._hsq = window._hsq || []);
  58.             _hsq.push(["identify",{
  59.                 email: "{{ userEmail }}",
  60.                 id: "{{ userId }}"
  61.             }]);
  62.             _hsq.push(['setPath', '{{ app.request.pathInfo }}']);
  63.             _hsq.push(['trackPageView']);
  64.         });
  65. </script>