{% extends "oscar/partials/google_analytics.html" %}
{% load l10n %}
{% block extratracking %}
    gtag('event', 'purchase', {
    "transaction_id": '{{ order.number|escapejs }}',
    "affiliation": '{{ shop_name|escapejs }}',
    "value": '{{ order.total_incl_tax|unlocalize|escapejs }}',
    "currency": '{{ order.currency|escapejs }}',
    "tax": '{{ order.total_tax|unlocalize|escapejs }}',
    "shipping": '{{ order.shipping_incl_tax|unlocalize|escapejs }}',
    items: [
    {% for line in order.lines.all %}
        {
        'id': '{{ line.partner_sku|escapejs }}',
        'name': '{{ line.title|escapejs }}',
        'category': '{{ line.category|default:"Uncategorised"|escapejs }}',
        'price': '{{ line.unit_price_incl_tax|unlocalize|escapejs }}',
        'quantity': '{{ line.quantity|escapejs }}'
        }
        {% if not forloop.last %},{% endif %}
    {% endfor %}
    ]
    });
{% endblock %}
