Files
wyczarujprezent.pl/modules/cookiesplus/views/templates/hook/gtm_consentmode.tpl
2024-10-28 22:14:22 +01:00

56 lines
2.6 KiB
Smarty

{**
* ISC License
*
* Copyright (c) 2024 idnovate.com
* idnovate is a Registered Trademark & Property of idnovate.com, innovación y desarrollo SCP
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*
* @author idnovate
* @copyright 2024 idnovate
* @license https://www.isc.org/licenses/ https://opensource.org/licenses/ISC ISC License
*}
{assign var="gtm_tmp" value=[]}
{foreach from=$gtm item=gtm_single}
{foreach from=$gtm_single item=value key=key}
{assign var="gtm_tmp" value=$gtm_tmp|@array_merge:[$key => $value]}
{/foreach}
{/foreach}
<script data-keepinline='true'>
{assign var="consentType" value="default"}
{foreach $gtm as $key => $value}
{if $value}
{assign var="consentType" value="update"}
{break}
{/if}
{/foreach}
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('consent', '{$consentType}', {
'ad_storage' : '{if isset($gtm_tmp['ad_storage']) && $gtm_tmp['ad_storage']}granted{else}denied{/if}',
'ad_user_data' : '{if isset($gtm_tmp['ad_user_data']) && $gtm_tmp['ad_user_data']}granted{else}denied{/if}',
'ad_personalization' : '{if isset($gtm_tmp['ad_personalization']) && $gtm_tmp['ad_personalization']}granted{else}denied{/if}',
'analytics_storage' : '{if isset($gtm_tmp['analytics_storage']) && $gtm_tmp['analytics_storage']}granted{else}denied{/if}',
'functionality_storage' : '{if isset($gtm_tmp['functionality_storage']) && $gtm_tmp['functionality_storage']}granted{else}denied{/if}',
'personalization_storage' : '{if isset($gtm_tmp['personalization_storage']) && $gtm_tmp['personalization_storage']}granted{else}denied{/if}',
'security_storage' : '{if isset($gtm_tmp['security_storage']) && $gtm_tmp['security_storage']}granted{else}denied{/if}',
'wait_for_update' : 1000
});
gtag('set', 'url_passthrough', false);
gtag('set', 'ads_data_redaction', true);
</script>