{% sw_extends '@Storefront/storefront/base.html.twig' %}
{% block base_body_script %}
{% with %}
{% if config('mediameetsFbPixel.config.pixelIds') and config('mediameetsFbPixel.config.pixelIds') is not empty %}
{% set pluginConfig = config('mediameetsFbPixel.config') %}
{% set csrfToken = sw_csrf('frontend.mediameetsFbPixel.conversionApi', {"mode": "token"}) %}
{% if shopware.csrfMode is same as ('ajax') %}
{% set csrfToken = null %}
{% endif %}
{% set pluginOptions = {
'config': {
'pixelIds': pluginConfig.pixelIds,
'privacyMode': pluginConfig.privacyMode,
'autoConfig': pluginConfig.autoConfig,
'advancedMatching': pluginConfig.advancedMatching,
'includeShippingCosts': pluginConfig.includeShippingCosts,
'useConversionApi': pluginConfig.useConversionApi,
'disablePushState': pluginConfig.disablePushState,
'conversionApiDeduplication': pluginConfig.conversionApiDeduplication
},
'shop': {
'controller': controllerName|lower,
'action': controllerAction|lower,
'currency': context.currency.isoCode
},
'routes': {
'store-api.cart': path('store-api.checkout.cart.read'),
'store-api.context': path('store-api.context'),
'store-api.order': path('store-api.order')
},
'conversionApi': {
'endpoint': path('frontend.mediameetsFbPixel.conversionApi'),
'token': csrfToken
}
} %}
<div data-mediameets-facebook-pixel-options='{{ pluginOptions|json_encode }}'></div>
{% endif %}
{% endwith %}
{{ parent() }}
{% endblock %}