Google Prestashop 1.7 管理中的分析
Google analytics in Prestashop 1.7 admin
我正在尝试将 Google Analytics 插入我们的后台,有没有人找到合适的文件来编辑或为此找到模块?
到目前为止,我尝试使用 /admin/themes/templates/header.tpl,但遗憾地失败了。
有人做到了吗?
您必须编辑两个文件:
对于登录页面:
/admin/themes/default/template/controllers/login/header.tpl
对于所有其他人:/admin/themes/new-theme/template/header.tpl
然后只需在 smarty 模板中添加文字即可避免 JS 被执行:
{literal}
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-XXXXX-X'); // Replace your UA here
</script>
{/literal}
我正在尝试将 Google Analytics 插入我们的后台,有没有人找到合适的文件来编辑或为此找到模块?
到目前为止,我尝试使用 /admin/themes/templates/header.tpl,但遗憾地失败了。
有人做到了吗?
您必须编辑两个文件:
对于登录页面: /admin/themes/default/template/controllers/login/header.tpl
对于所有其他人:/admin/themes/new-theme/template/header.tpl
然后只需在 smarty 模板中添加文字即可避免 JS 被执行:
{literal}
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-XXXXX-X'); // Replace your UA here
</script>
{/literal}