问题描述
我在 Prestashop 上有一个网站。 head 标签之间有一个 gtag 代码。 我必须替换此代码。我看了~/www/site/themes/laber_complex_home1/templates/_partials/head.tpl 等等,但我在这里没有看到 gtag 代码。我怎样才能改变它。是否有用户将自定义代码添加到 head 标签的地方。抱歉,我是新来的 prestashop。
{block name='head_charset'}
<Meta charset="utf-8">
{/block}
{block name='head_ie_compatibility'}
<Meta http-equiv="x-ua-compatible" content="ie=edge">
{/block}
{block name='head_SEO'}
<title>{block name='head_SEO_title'}{$page.Meta.title}{/block}</title>
<Meta name="description" content="{block name='head_SEO_description'}{$page.Meta.description}{/block}">
<Meta name="keywords" content="{block name='head_SEO_keywords'}{$page.Meta.keywords}{/block}">
{if $page.Meta.robots !== 'index'}
<Meta name="robots" content="{$page.Meta.robots}">
{/if}
{if $page.canonical}
<link rel="canonical" href="{$page.canonical}">
{/if}
{/block}
{block name='head_viewport'}
<Meta name="viewport" content="width=device-width,initial-scale=1">
{/block}
{block name='head_icons'}
<link rel="icon" type="image/vnd.microsoft.icon" href="{$shop.favicon}?{$shop.favicon_update_time}">
<link rel="shortcut icon" type="image/x-icon" href="{$shop.favicon}?{$shop.favicon_update_time}">
{/block}
<script type="text/javascript" src="{$urls.js_url}jquery-1.7.1.min.js"></script>
{block name='stylesheets'}
{include file="_partials/stylesheets.tpl" stylesheets=$stylesheets}
{/block}
{block name='javascript_head'}
{include file="_partials/javascript.tpl" javascript=$javascript.head vars=$js_custom_vars}
{/block}
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i,700,700i,800,800i" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Roboto:100,100i,300,500,500i,900,900i" rel="stylesheet">
{block name='hook_header'}
{$HOOK_HEADER nofilter}
{/block}
{block name='hook_extra'}{/block}
{hook h='displayAdminlabthemeoptions'}
解决方法
在那里找不到它可能有两个原因。
- 它可能根本就不是正确的地方
- 它可能通过模块嵌入
在您的整个存储库中搜索字符串 googletagmanager
并查看脚本是否位于其他位置。一般来说,脚本应该是这样的
{literal} <!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-*********-*"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js',new Date());
gtag('config','UA-*********-*');
</script>
{/literal}
如果您找不到任何东西,很有可能是第三方模块为您嵌入了脚本。在这种情况下,请转到 Prestashop 后台并点击模块 -> 模块管理器并搜索与 Google 分析一致的内容。