Google 跟踪代码管理器
Google 跟踪代码管理器
本页相关主题
使用 Google Tag Manager 的注意事项
将 Google 跟踪代码管理器代码添加到您的模板中
验证是否已安装 Google 跟踪代码管理器
相关链接
使用 Google Tag Manager 的注意事项
若要对 Shopify Plus 的在线商店使用 Google Tag Manager,请执行以下操作:
拥有
checkout.liquid
文件的访问权限。如果您无权在模板代码中访问此文件,请联系 Shopify Plus 支持获取访问权限。将 Shopify 的集成用于 Google Analytics 和 Facebook Pixel,而不是将其用于 Google 跟踪代码管理器。
将 Google Tag Manager 提供的代码片段复制到您的
theme.liquid
和checkout.liquid
模板文件中。
将 Google 跟踪代码管理器代码添加到您的模板中
步骤:
安装 Google 跟踪代码管理器 以获取您需要复制并粘贴到 Shopify 商店中的代码片段。由于 Shopify 使用模板,因此您只需将代码片段复制到
theme.liquid
和checkout.liquid
文件。如果这是您首次安装 Google 跟踪代码管理器,请使用 Google 跟踪代码管理器提供的安装步骤。在您获得要向网页添加的两个代码片段的步骤时暂停,然后按照以下说明操作。
如果您已安装 Google 跟踪代码管理器,则可通过依次点击后台和安装 Google 跟踪代码管理器,在 Google 跟踪代码管理器中找到这些代码片段。
在 Shopify 后台,点击在线商店,然后点击模板。
在模板下拉菜单中,点击编辑代码。
将 Google Tag Manager 中的第一个代码片段复制到您的
theme.liquid
和checkout.liquid
代码的<head>
标记中:复制 Google 跟踪代码管理器中的第一个代码片段
在您的 Shopify 后台中,打开
theme.liquid
文件。将代码片段粘贴到
theme.liquid
代码的<head>
中尽可能高的位置。打开您的
checkout.liquid
文件。将代码片段粘贴到
checkout.liquid
代码的<head>
中尽可能高的位置。将 Google 跟踪代码管理器中的第二个代码片段复制到您的
theme.liquid
和checkout.liquid
代码的<body>
标签:在您的 Shopify 后台,打开
theme.liquid
页面。将代码片段粘贴到
theme.liquid
页面的<body>
中尽可能靠前的位置。打开
checkout.liquid
页面。将代码片段粘贴到
checkout.liquid
代码的<body>
中尽可能高的位置。在 Shopify 后台,点击保存。
在 Google Tag Manager 中,继续安装 Google Tag Manager。当系统提示您添加标记时,请勿添加以下类型的标记:
适用于 Google Analytics 的 Universal Analytics
适用于 Google Analytics 的 Classic Google Analytics
Facebook Pixel。
验证是否已安装 Google 跟踪代码管理器
要验证您是否已正确安装 Google 跟踪代码管理器,您可以使用:
Google 跟踪代码管理器中的预览模式
Google Tag Assistant Chrome 扩展。
相关链接
theme.liquid
checkout.liquid
Google 跟踪代码管理器文档
在 Shopify 中使用 Google Analytics
在 Shopify 中使用 Facebook Pixel
Shopify商户官网原文详情:
Google Tag Manager
On this page
Considerations for using Google Tag Manager
Add Google Tag Manager code to your theme
Verify that Google Tag Manager is installed
Related links
Considerations for using Google Tag Manager
To use Google Tag Manager with your Shopify Plus online store, you do the following:
Have access to the
checkout.liquid
file. If you don't have access to this file in your theme code, then contact Shopify Plus Support to gain access.Use Shopify's integration for Google Analytics and Facebook Pixel instead of using them with Google Tag Manager.
Copy the code snippets that are provided by Google Tag Manager into your
theme.liquid
andcheckout.liquid
theme files.Add Google Tag Manager code to your theme
Steps:
Install Google Tag Manager to get the code snippets that you will need to copy and paste into your Shopify store. Because Shopify uses templates, you only need to copy the snippets into the
theme.liquid
andcheckout.liquid
files.
If this is your first time installing Google Tag Manager, then use the installation steps provided by Google Tag Manager. Pause at the step where you are given two code snippets to add to your web pages, and then follow the instructions below.
If you have already installed Google Tag Manager, then you can find these code snippets in your Google Tag Manager by clicking Admin, and then clicking Install Google Tag Manager.
In your Shopify admin, click Online store, and then click Themes.
In the theme drop-down, click Edit Code.
Copy the first code snippet from Google Tag Manager into the
<head>
tags of yourtheme.liquid
andcheckout.liquid
code:
Copy the first code snippet from Google Tag Manager
In your Shopify admin, open your
theme.liquid
file.Paste the code snippet as high in the
<head>
of thetheme.liquid
code as possible.Open your
checkout.liquid
file.Paste the code snippet as high in the
<head>
of thecheckout.liquid
code as possible.Copy the second code snippet from the Google Tag Manager into the
<body>
tags of yourtheme.liquid
andcheckout.liquid
code:
In your Shopify admin, open the
theme.liquid
page.Paste the code snippet as high in the
<body>
of thetheme.liquid
page as possible.Open the
checkout.liquid
page.Paste the code snippet as high in the
<body>
of thecheckout.liquid
code as possible.In your Shopify admin, click Save.
In Google Tag Manager, continue installing the Google Tag Manager. When prompted to add tags, do not add the following types of tags:
Universal Analytics for Google Analytics
Classic Google Analytics for Google Analytics
Facebook Pixel.
Verify that Google Tag Manager is installed
To verify that you installed Google Tag Manager properly, you can use:
the Preview Mode in Google Tag Manager
the Google Tag Assistant Chrome Extension.
Related links
theme.liquid
checkout.liquid
Google Tag Manager documentation
Working with Google Analytics in Shopify
Using Facebook Pixel in Shopify
文章内容来源:Shopify商户官方网站