app/Plugin/UaGaEEc4/Resource/template/default/uagaeec_gtag.twig line 1

Open in your IDE?
  1. {#
  2. UaGaEEc: Google Analytics eコマース/拡張eコマース対応プラグイン
  3. Copyright (C) 2016-2021 Freischtide Inc. All Rights Reserved.
  4. http://freischtide.tumblr.com/
  5. License: see LICENSE.txt
  6. #}
  7. {% if uagaeec.tid|length > 0 %}
  8.   <script async src="https://www.googletagmanager.com/gtag/js?id={{ uagaeec.tid|split(',')|first|trim }}"></script>
  9.   <script type="text/javascript" id="uagaeec_tag">
  10.     window.dataLayer = window.dataLayer || [];
  11.     function gtag(){dataLayer.push(arguments);}
  12.     gtag('js', new Date());
  13.     {% for tid in uagaeec.tid|split(',') %}
  14.     gtag('config', '{{ tid|trim }}', {
  15.       "name": "plg_uagaeec",
  16.       {% if uagaeec.track_user_id == constant('Plugin\\UaGaEEc4\\Entity\\UaGaEEc::UAGAEEC_OP_INCLUDE_USER_ID') and user_id is defined %}
  17.         "userId": "{{ user_id }}",
  18.       {% endif %}
  19.       {% if crossdomain_linker is defined %}
  20.         "linker": {
  21.           "domains": [{{ crossdomain_linker|raw }}]
  22.         },
  23.       {% endif %}
  24.       "cookie_domain": "auto"
  25.     });
  26.     {% endfor %}
  27.     {% if uagaeec.eec == constant('Plugin\\UaGaEEc4\\Entity\\UaGaEEc::UAGAEEC_USE_EEC') %}
  28.       {% include partial %}
  29.     {% elseif uagaeec.eec == constant('Plugin\\UaGaEEc4\\Entity\\UaGaEEc::UAGAEEC_USE_EC') %}
  30.       {% if partial == '@UaGaEEc4/default/_shopping_complete.twig' %}
  31.         {% include partial %}
  32.       {% endif %}
  33.     {% endif %}
  34.     {% if uagaeec.user_timings == constant('Plugin\\UaGaEEc4\\Entity\\UaGaEEc::UAGAEEC_OP_WITH_USER_TIMINGS') %}
  35.       if (window.performance) {
  36.         var timeSincePageLoad = Math.round(performance.now());
  37.         gtag('event', 'timing_complete', {
  38.           "name": "load",
  39.           "value": timeSincePageLoad,
  40.           "event_category": "EC-CUBE UaGaEEc Plugin"
  41.         });
  42.       }
  43.     {% endif %}
  44.   </script>
  45. {% endif %}