开发者 |
inpsyde
chrico vanvox |
---|---|
更新时间 | 2020年11月24日 15:36 |
PHP版本: | 7.0 及以上 |
WordPress版本: | 5.6 |
版权: | GPLv3 |
版权网址: | 版权信息 |
<noscript>
tag can be inserted automatically or via hook (see FAQ).wp-content\plugins
of your WordPress installation.
Go to Plugins => Installed Plugins and click Activate on Inpsyde Google Tag Manager.Before you can get started with Google Tag Manager, you'll need a GTM account and a container. Instructions can be found in GTM Help. Then you install the Google Tag Manager via our plugin Inspyde Google Tag Manager on your website.
Visit the Google Tag Manager homepage. There you will find all your Google Tag Manager accounts and the included Containers with their IDs listed.
The Google Tag Manager code consists of two parts. The first part belongs in the <head>
of your website. The second part, the so-called <noscript>
tag, must be inserted after the opening <body>
tag of your website. Unfortunately, WordPress does not provide a way to safely insert the <noscript>
tag after the opening <body>
tag, since there is no WordPress hook for this.
Our plugin offers you two options:
<body>
tag. This method may possibly conflict with other plugins.inpsyde-google-tag-manager.render-noscript
, which makes it possible to insert the <noscript>
tag safely after the opening <body>
tag.header.php
file of your theme in case something goes wrong.<body>
tag and then add the code <? php do_action( "inpsyde-google-tag-manager.render-noscript" ); ?>
.The Data Layer is a memory (the Javascript Array dataLayer[]) that is used to exchange information between your website and the Google Tag Manager. For example, you can write in the data layer to see if the visitor to your website is logged in or not. The GTM can use this information to perform certain actions only for non-logged-in visitors. For example, if you implement Google Analytics Tracking through Google Tag Manager, you will only send data to Google Analytics for non-logged-in visitors.
The Inpsyde Google Tag Manager writes certain information into the data layer for you. Exactly what is currently available can be found in the description in the section "Data Layer Outputs". You only have to activate the writing of the individual data on the settings pages of the plugin. You miss something? Get in contact with us!
The three key terms in implementing Google Tag Manager are tags, triggers and variables.
When creating a variable in the GTM, certain variable types are available to you, including the variable type "Data Layer Variable". Select this. Via the name of the data layer variables you specify which information is to be read from the data layer. For nested variables, you're using "." towards this. The exact name you take from the Data Layer, which you can see for example in the GTM preview mode.
Example: To access the user role with a GTM data layer variable, enter the name user.role
.
Implementing Google Analytics tracking is a common use case for using Google Tag Manager. Instructions for a basic implementation can be found in GTM Help. Control over the data layer that the plugin "Inpsyde Google Tag Manager" fills, for example for which user roles the tracking should take place.
When you set up tags in the GTM, you should always check that they work as intended. To identify problems, you can use the following tools, for example:
You are a WordPress developer and love the hook concept of WordPress? Currently our plugin offers you the following possibilities to hook you in:
inpsyde-google-tag-manager.error
- This action is triggered when an error occurs in our plugin.inpsyde-google-tag-manager.debug
- This action can be used to facilitate debugging and provides helpful information about the current page.inpsyde-google-tag-manager.boot
- This action allows you to add your own service providers and settings to the plugin DI-container.inpsyde-google-tag-manager.before-script
- This action allows you to insert custom markup before the GTM script tag.inpsyde-google-tag-manager.after-script
- This action allows you to insert custom markup after the GTM script tag.inpsyde-google-tag-manager.render-noscript
- This action can be called manually in content to render the <noscript>
tag.inpsyde/assets
to version ~2.1
.