YouTube videos that could help you do this task :
How to ad Google Tag Manager to WordPress :
How To Install Google Tag Manager, Google Analytics, & Google Search Console On a WordPress Website :
Goal: To add Google Tag Manager to a WordPress site.
Ideal Outcome: Google Tag Manager is properly installed without any technical issues.
Prerequisites or requirements: This exact process only applies to WordPress.org sites.
Why this is important: Google Tag Manager is a great tool to add and manage multiple pixels and tracking codes without needing to edit the code of a site.
Where this is done: In your WordPress install and Google Tag Manager.
When this is done: Only onceâthe first time you install Google Tag Manager.
Who does this: The person responsible for website management or analytics.
- Environment Setup
**Important**: This SOP works only for self-hosted WordPress sites, aka WordPress.org and not WordPress.com
- Download the Google Tag Assistant Legacy Chrome Extension (Free)
- Sign up for Google Tag Manager (Free):
- Youâll need to log in to your Google account.
- If this is your first time creating a Google Tag Manager Account, youâll be prompted to set up one right away.
- You can just use your company/website name for both the account and container.
- Under âWhere to Use Containerâ, select âWebâ
- Accept the terms and conditions.
- You will see your Google Tag Manager code, but you wonât need it using this method.
- Once, you are in your Workspace, make note of your Google Tag Manager ID.
- Click on Submit > Publish > Continue to publish your Google Tag Manager container
- Install and configure the Google Tag Manager WordPress plugin
- Log into your WordPress site.
- In the WordPress sidebar, go to Plugins > Add New
- Enter âGoogle Tag Manager for WordPressâ in the search box
- Install the Google Tag Manager for WordPress plugin (the image may vary)
- Activate the plugin
- In the WordPress sidebar, go to Settings > Google Tag Manager
- Paste your Google Tag Manager ID (the one you got from the Google Tag Manager dashboard) in the available field
- The plugin offers several ways to install the container code on your site. Before you implement any of these, we recommend you create a backup of your site.
- Option 1: Codeless injection â with this option, the plugin will try to figure out the right placement for the container for you. This is the easiest option but thereâs a small risk it might break something on the frontend of your site. If you decide to go with codeless injection, select this option from the list and click âSave changesâAfter selecting this, visit the website in a new tab or window and make sure everything looks right. If it does, you can move on to the next step of QA-ing the installation.
- Option 2: Custom â with this option, you will need to make a small edit to your theme files. If your WordPress theme allows you to make changes and youâre comfortable with the theme editor, you can use this option. Select the âCustom (needs tweak in your template)â container code placement and click on âSave Changes.â
- Copy the php code provided by the plugin and click on âSave Changesâ
- In the WordPress sidebar, go to Appearance > Theme Editor
- Make sure that you are editing the Theme that you currently have installed in your site (you can go to Appearance > Themes to check the name of the theme you are using)
- Select the âTheme Headerâ template from the list on the right.
- This template is different depending on the theme that you have installed. However, you will alway be able to find an opening <body> tag in the code.
- Paste the php code provided by the plugin right below the opening <body> tag.
- Click on âUpdate Fileâ
- QA-ing your installation
- Open your website homepage using Chrome.
- Click on the Google Tag Assistant Chrome Extension
- Click on âEnableâ
- Refresh the page and click on the Google Tag Assistant Chrome Extension again
- You should see a green tag for Google Tag Manager, indicating that the installation was successful.