微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何在 prestashop 中更改现有的 gtag 代码

如何解决如何在 prestashop 中更改现有的 gtag 代码

我在 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'}

解决方法

在那里找不到它可能有两个原因。

  1. 它可能根本就不是正确的地方
  2. 它可能通过模块嵌入

在您的整个存储库中搜索字符串 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 分析一致的内容。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。