{#
UaGaEEc: Google Analytics eコマース/拡張eコマース対応プラグイン
Copyright (C) 2016-2021 Freischtide Inc. All Rights Reserved.
http://freischtide.tumblr.com/
License: see LICENSE.txt
#}
{% if uagaeec.tid|length > 0 %}
<script async src="https://www.googletagmanager.com/gtag/js?id={{ uagaeec.tid|split(',')|first|trim }}"></script>
<script type="text/javascript" id="uagaeec_tag">
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
{% for tid in uagaeec.tid|split(',') %}
gtag('config', '{{ tid|trim }}', {
"name": "plg_uagaeec",
{% if uagaeec.track_user_id == constant('Plugin\\UaGaEEc4\\Entity\\UaGaEEc::UAGAEEC_OP_INCLUDE_USER_ID') and user_id is defined %}
"userId": "{{ user_id }}",
{% endif %}
{% if crossdomain_linker is defined %}
"linker": {
"domains": [{{ crossdomain_linker|raw }}]
},
{% endif %}
"cookie_domain": "auto"
});
{% endfor %}
{% if uagaeec.eec == constant('Plugin\\UaGaEEc4\\Entity\\UaGaEEc::UAGAEEC_USE_EEC') %}
{% include partial %}
{% elseif uagaeec.eec == constant('Plugin\\UaGaEEc4\\Entity\\UaGaEEc::UAGAEEC_USE_EC') %}
{% if partial == '@UaGaEEc4/default/_shopping_complete.twig' %}
{% include partial %}
{% endif %}
{% endif %}
{% if uagaeec.user_timings == constant('Plugin\\UaGaEEc4\\Entity\\UaGaEEc::UAGAEEC_OP_WITH_USER_TIMINGS') %}
if (window.performance) {
var timeSincePageLoad = Math.round(performance.now());
gtag('event', 'timing_complete', {
"name": "load",
"value": timeSincePageLoad,
"event_category": "EC-CUBE UaGaEEc Plugin"
});
}
{% endif %}
</script>
{% endif %}