Post by account_disabled on Dec 9, 2023 10:47:55 GMT
用于多站点管理的 Google 跟踪代码管理器环境 在本文中,我们将了解如何从单个 Google 跟踪代码管理器设置生产网站、预生产和测试环境。 在专业领域,多站点配置以及验证和质量工作流程至关重要。 事实上,大多数大公司都有一个流程来发布涉及多个部署环境的网站更改。 典型的配置由以下部分组成: 开发团队测试新网站功能的测试环境。 预生产是复制生。 生产环境是托管您的公共网站的环境——每个人都能看到的网站。 根据网站架构和业务流程的复杂性,您可能拥有更多或更少的环境。 您网站的每个新版本都将从一种环境到另一种环境进行测试,直到经过完全验证并上线。 谷歌标签管理器和“ 环境 ”功能将允许您在将营销标签部署到生产环境之前在不同的网站上测试它们。 在本教程结束时,您将拥有 Google 跟踪代码管理器的高级配置,并且能够在不同的网站上发布和测试您的代码。质量工作流程将不再对您有任何秘密。 内容 Google 跟踪代码管理器中的环境功能是什么? 使用 Google 跟踪代码管理器创建测试环境 了解 Google 跟踪代码管理器的质量检查工作流程 首先创建一个测试Javascript标签 然后是新版本的工作区 将您的更改发布到预制作中 在生产中部署您的营销标签 掌握您的标签部署 使用 Google 跟踪代码管理器走得更远 Google 跟踪代码管理器中的环境功能是什么? Google 跟踪代码管理器提供了一项名为“环境”的功能。它允许您在将新营销技术上线之前,在您的测试或预生产环境中测试其集成。 在将标签管理器中配置的不同脚本、事件或目标发布到高效网站之前,必须能够验证它们是否正常工作。
要访问 Google 跟踪代码管理器中的环境,请转至管理视图并点击环境。 GTM 环境功能 如您所见,您已经有两个环境:Live 和 Latest: Live是您的生产站点的默认名称 最新代表容器的最新版本。例如,当您保存新版本时,可以从最新环境 工作职能邮件数据库 中使用它。 使用 Google 跟踪代码管理器创建测试环境 您可以选择正确的名称或符合公司政策的名称。在以下示例中,我将我的预生产环境命名为:Staging。 要创建新环境,请执行以下步骤: 单击环境面板中的新建 设置名称、描述和 URL 单击创建环境 然后会弹出一个窗口邀请您发布 因此,创建的新环境将与 Live 的配置级别完全相同(代表您的生产站点的配置级别) 使用 Google 跟踪代码管理器创建测试环境 恭喜,您现在拥有三个环境:Live、Latest 和 Staging。 现在最后一步包括在预生产网站上安装暂存环境代码( Google 跟踪代码管理器代码片段)。 该过程与我们之前所做的类似: 在“ 环境”面板中,单击“操作” 链接 复制暂存片段并将其粘贴到您的暂存网站中 安装 Google 跟踪代码管理器暂存环境代码 重要提示:创建新环境后,您还必须修改生产网站上安装的代码段。从实时环境中获取提取内容并将其替换到您的生产站点上。 太棒了,现在 Google 跟踪代码管理器中有两个不同的环境。
到目前为止,它们的配置完全相同。让我们尝试在将 Staging 部署到生产环境之前对其进行更改。 了解 Google 跟踪代码管理器的质量检查工作流程 Google 跟踪代码管理器的质量检查流程非常简单,并且利用了版本控制和环境功能。 基本上,过程如下: 创建包含要测试的标签的新版本工作区 将版本发布到暂存环境并测试 如果一切正常,将版本发布到生产环境 为了更好地理解这些步骤,我们将在暂存环境中安装一个虚拟 Javascript 标签,并对其进行测试。然后我们将在生产网站上部署这个标签。 首先创建一个测试Javascript标签 该标签是一个简单的 Javascript,它将“ Hello ”打印 到浏览器的 Javascript 控制台。(不用担心,您不需要计算机科学硕士学位即可做到这一点) 创建一个新的自定义 HTML标签并将以下代码复制到 HTML 块中: <script> console.log("Hello"); </script> 创建新的自定义 HTML 标签 然后是新版本的工作区 创建标签后,在“ 工作区”面板中,单击“ 提交”,这一次,单击“ 创建版本”。 仅供参考,如果您单击“ 发布并创建版本”,您的更改将在生产中可用,但这不是我们目前想要的。 我们只想创建一个新版本的工作区。 GTM - 创建新版本的工作区。 结果:我们在跟踪代码管理器中拥有两个版本的容器或两种不同的配置: 包含初始 Google Analytics 标签的第一个版本 第二个版本带有 Google Analytics 标签和“ Hello ” javascript 标签 如您所见,只有版本 1 已上线,并且当前应用于 Live 和 Staging 环境。 跟踪代码管理器中提供两个版本的容器或两种不同的配置 注意:如前所述,“Latest”代表容器的最新版本,现在指向版本 2。
要访问 Google 跟踪代码管理器中的环境,请转至管理视图并点击环境。 GTM 环境功能 如您所见,您已经有两个环境:Live 和 Latest: Live是您的生产站点的默认名称 最新代表容器的最新版本。例如,当您保存新版本时,可以从最新环境 工作职能邮件数据库 中使用它。 使用 Google 跟踪代码管理器创建测试环境 您可以选择正确的名称或符合公司政策的名称。在以下示例中,我将我的预生产环境命名为:Staging。 要创建新环境,请执行以下步骤: 单击环境面板中的新建 设置名称、描述和 URL 单击创建环境 然后会弹出一个窗口邀请您发布 因此,创建的新环境将与 Live 的配置级别完全相同(代表您的生产站点的配置级别) 使用 Google 跟踪代码管理器创建测试环境 恭喜,您现在拥有三个环境:Live、Latest 和 Staging。 现在最后一步包括在预生产网站上安装暂存环境代码( Google 跟踪代码管理器代码片段)。 该过程与我们之前所做的类似: 在“ 环境”面板中,单击“操作” 链接 复制暂存片段并将其粘贴到您的暂存网站中 安装 Google 跟踪代码管理器暂存环境代码 重要提示:创建新环境后,您还必须修改生产网站上安装的代码段。从实时环境中获取提取内容并将其替换到您的生产站点上。 太棒了,现在 Google 跟踪代码管理器中有两个不同的环境。
到目前为止,它们的配置完全相同。让我们尝试在将 Staging 部署到生产环境之前对其进行更改。 了解 Google 跟踪代码管理器的质量检查工作流程 Google 跟踪代码管理器的质量检查流程非常简单,并且利用了版本控制和环境功能。 基本上,过程如下: 创建包含要测试的标签的新版本工作区 将版本发布到暂存环境并测试 如果一切正常,将版本发布到生产环境 为了更好地理解这些步骤,我们将在暂存环境中安装一个虚拟 Javascript 标签,并对其进行测试。然后我们将在生产网站上部署这个标签。 首先创建一个测试Javascript标签 该标签是一个简单的 Javascript,它将“ Hello ”打印 到浏览器的 Javascript 控制台。(不用担心,您不需要计算机科学硕士学位即可做到这一点) 创建一个新的自定义 HTML标签并将以下代码复制到 HTML 块中: <script> console.log("Hello"); </script> 创建新的自定义 HTML 标签 然后是新版本的工作区 创建标签后,在“ 工作区”面板中,单击“ 提交”,这一次,单击“ 创建版本”。 仅供参考,如果您单击“ 发布并创建版本”,您的更改将在生产中可用,但这不是我们目前想要的。 我们只想创建一个新版本的工作区。 GTM - 创建新版本的工作区。 结果:我们在跟踪代码管理器中拥有两个版本的容器或两种不同的配置: 包含初始 Google Analytics 标签的第一个版本 第二个版本带有 Google Analytics 标签和“ Hello ” javascript 标签 如您所见,只有版本 1 已上线,并且当前应用于 Live 和 Staging 环境。 跟踪代码管理器中提供两个版本的容器或两种不同的配置 注意:如前所述,“Latest”代表容器的最新版本,现在指向版本 2。