app/template/default/Common/dataLayer.twig line 1

Open in your IDE?
  1. <script>
  2.     //
  3.     window.dataLayer = window.dataLayer || [];
  4.     //
  5.     {% if dataLayer is defined %}{% for key, value in dataLayer %}
  6.     {% if key is numeric %}
  7.     dataLayer.push({{ value | json_encode | raw }});
  8.     {% else %}
  9.     dataLayer.push({"{{ key }}": {{ value | json_encode | raw }}});
  10.     {% endif %}
  11.     {% endfor %}{% endif %}
  12. </script>
  13. <script type="text/javascript" src="https://static.criteo.net/js/ecp_solutions/crto_sha256.js"></script>
  14. <script type="text/javascript">
  15.     {% if app.user is not empty and app.user.email is not empty %}
  16.         if (Array.isArray(dataLayer)) {
  17.             dataLayer.push({
  18.                 gtm_customer: {
  19.                     customer_email_hashed: crto_sha256("{{ app.user.email }}"),
  20.                 },
  21.             });
  22.         }
  23.     {% endif %}
  24. </script>