How to disable a code in GTM from firing on homepageHow do I use custom image tag?How to avoid double counting GA eCommerce transactions with GTMHow does GTM work and why aren't events firing?How to assign the first user referer (source / medium) to an event with GTM and GA?How to exclude main domain from subdomain tracking in Google Analytics or GTM?How to add AggregateRating in GTM using DOM element Variables?Proxy Sale - Affiliate Fraud on Thank You pageIs it ok to filter sensitive user information from GA hits in GTM (rather than in app)?How to listen to gtm events fire from javascript file in my webpage?How do I implement a setTimeout event to adjust the bounce rate with Google Analytics snippet included in Google Tag Manager?
Does the Bracer of Flying Daggers really let a thief make 4 attacks per round?
Masyu-making game
Why do we need an estimator to be consistent?
What are my hardware upgrade optoins for a late 2009 iMac?
Did Hitler say this quote about homeschooling?
Somebody hacked my clock
Does a hash function have a Upper bound on input length?
Extract the attribute names from a large number of Shapefiles
Should I have one hand on the throttle during engine ignition?
Why are there few or no black super GMs?
Why xargs uses -t to enable verbose mode?
Why would word of Princess Leia's capture generate sympathy for the Rebellion in the Senate?
Are there foods that astronauts are explicitly never allowed to eat?
Why don't humans perceive sound waves as twice the frequency they are?
Project Euler # 25 The 1000 digit Fibonacci index
Simplest instruction set that has an c++/C compiler to write an emulator for?
Could a US citizen born through "birth tourism" become President?
I have found a mistake on someone's code published online: what is the protocol?
Is "repository" pronounced /rɪˈpɒzɪt(ə)ri/ or ri-ˈpä-zə-ˌtȯr-ē or /rəˈpäzəˌtôrē/?
What's the largest an Earth-like planet can be and support Earth's biosphere?
What is the function of "mal" in saying "Das nenn ich mal ein X"?
Are there any satellites in geosynchronous but not geostationary orbits?
When will the last unambiguous evidence of mankind disappear?
Should I have shared a document with a former employee?
How to disable a code in GTM from firing on homepage
How do I use custom image tag?How to avoid double counting GA eCommerce transactions with GTMHow does GTM work and why aren't events firing?How to assign the first user referer (source / medium) to an event with GTM and GA?How to exclude main domain from subdomain tracking in Google Analytics or GTM?How to add AggregateRating in GTM using DOM element Variables?Proxy Sale - Affiliate Fraud on Thank You pageIs it ok to filter sensitive user information from GA hits in GTM (rather than in app)?How to listen to gtm events fire from javascript file in my webpage?How do I implement a setTimeout event to adjust the bounce rate with Google Analytics snippet included in Google Tag Manager?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
How can I disable a code from GTM on homepage? I want that code only on product pages.
Thank you
wordpress google-tag-manager
add a comment |
How can I disable a code from GTM on homepage? I want that code only on product pages.
Thank you
wordpress google-tag-manager
add a comment |
How can I disable a code from GTM on homepage? I want that code only on product pages.
Thank you
wordpress google-tag-manager
How can I disable a code from GTM on homepage? I want that code only on product pages.
Thank you
wordpress google-tag-manager
wordpress google-tag-manager
asked Jul 11 at 5:45
Adarsh MAdarsh M
62 bronze badges
62 bronze badges
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Gael's answer is probably the best, but i just wanted to let you know that there's also a possibility of having the GTM container code, but not actually tracking the home page.
In that case, you just need to create a trigger, that would look like in the image attached.
1
Thanx @Mnea but not sure my answer is the best. Your solution offers the same capabilities with the advantage not to have to edit the theme's files.
– gael
Jul 12 at 8:39
It actually depends, perhaps OP wanted to speed up the load time on home page for some reason, and by excluding the container this would probably do it. I just had to mention this solution, so that everything is covered.
– Mnea
Jul 12 at 15:46
add a comment |
The easyest way not to display Google Tag Manager on Homepage is to check with php.
You can insert GTM in the header.php
file of your child-theme
like this:
<?php
if (!is_home() && !is_front_page())
echo 'your GTM code here';
?>
Will display GTM everywhere but on home (blog posts homepage) nor on front page (the static page you may have defined as the home of your wordpress).
Then if you only want it on product pages there are a bunch of possibilities since there are a lot of product pages types (category page, single product page...).
But if you want it to display only on a few product pages type you could choose to display it only IF it's the good page type.
<?php
if (is_product())
echo 'your GTM code here';
?>
You will find woocommerce conditional tags here : https://docs.woocommerce.com/document/conditional-tags/ where you will be able to choose on which condition you want your GTM to display or not.
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "45"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fwebmasters.stackexchange.com%2fquestions%2f123938%2fhow-to-disable-a-code-in-gtm-from-firing-on-homepage%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Gael's answer is probably the best, but i just wanted to let you know that there's also a possibility of having the GTM container code, but not actually tracking the home page.
In that case, you just need to create a trigger, that would look like in the image attached.
1
Thanx @Mnea but not sure my answer is the best. Your solution offers the same capabilities with the advantage not to have to edit the theme's files.
– gael
Jul 12 at 8:39
It actually depends, perhaps OP wanted to speed up the load time on home page for some reason, and by excluding the container this would probably do it. I just had to mention this solution, so that everything is covered.
– Mnea
Jul 12 at 15:46
add a comment |
Gael's answer is probably the best, but i just wanted to let you know that there's also a possibility of having the GTM container code, but not actually tracking the home page.
In that case, you just need to create a trigger, that would look like in the image attached.
1
Thanx @Mnea but not sure my answer is the best. Your solution offers the same capabilities with the advantage not to have to edit the theme's files.
– gael
Jul 12 at 8:39
It actually depends, perhaps OP wanted to speed up the load time on home page for some reason, and by excluding the container this would probably do it. I just had to mention this solution, so that everything is covered.
– Mnea
Jul 12 at 15:46
add a comment |
Gael's answer is probably the best, but i just wanted to let you know that there's also a possibility of having the GTM container code, but not actually tracking the home page.
In that case, you just need to create a trigger, that would look like in the image attached.
Gael's answer is probably the best, but i just wanted to let you know that there's also a possibility of having the GTM container code, but not actually tracking the home page.
In that case, you just need to create a trigger, that would look like in the image attached.
answered Jul 11 at 8:45
MneaMnea
1267 bronze badges
1267 bronze badges
1
Thanx @Mnea but not sure my answer is the best. Your solution offers the same capabilities with the advantage not to have to edit the theme's files.
– gael
Jul 12 at 8:39
It actually depends, perhaps OP wanted to speed up the load time on home page for some reason, and by excluding the container this would probably do it. I just had to mention this solution, so that everything is covered.
– Mnea
Jul 12 at 15:46
add a comment |
1
Thanx @Mnea but not sure my answer is the best. Your solution offers the same capabilities with the advantage not to have to edit the theme's files.
– gael
Jul 12 at 8:39
It actually depends, perhaps OP wanted to speed up the load time on home page for some reason, and by excluding the container this would probably do it. I just had to mention this solution, so that everything is covered.
– Mnea
Jul 12 at 15:46
1
1
Thanx @Mnea but not sure my answer is the best. Your solution offers the same capabilities with the advantage not to have to edit the theme's files.
– gael
Jul 12 at 8:39
Thanx @Mnea but not sure my answer is the best. Your solution offers the same capabilities with the advantage not to have to edit the theme's files.
– gael
Jul 12 at 8:39
It actually depends, perhaps OP wanted to speed up the load time on home page for some reason, and by excluding the container this would probably do it. I just had to mention this solution, so that everything is covered.
– Mnea
Jul 12 at 15:46
It actually depends, perhaps OP wanted to speed up the load time on home page for some reason, and by excluding the container this would probably do it. I just had to mention this solution, so that everything is covered.
– Mnea
Jul 12 at 15:46
add a comment |
The easyest way not to display Google Tag Manager on Homepage is to check with php.
You can insert GTM in the header.php
file of your child-theme
like this:
<?php
if (!is_home() && !is_front_page())
echo 'your GTM code here';
?>
Will display GTM everywhere but on home (blog posts homepage) nor on front page (the static page you may have defined as the home of your wordpress).
Then if you only want it on product pages there are a bunch of possibilities since there are a lot of product pages types (category page, single product page...).
But if you want it to display only on a few product pages type you could choose to display it only IF it's the good page type.
<?php
if (is_product())
echo 'your GTM code here';
?>
You will find woocommerce conditional tags here : https://docs.woocommerce.com/document/conditional-tags/ where you will be able to choose on which condition you want your GTM to display or not.
add a comment |
The easyest way not to display Google Tag Manager on Homepage is to check with php.
You can insert GTM in the header.php
file of your child-theme
like this:
<?php
if (!is_home() && !is_front_page())
echo 'your GTM code here';
?>
Will display GTM everywhere but on home (blog posts homepage) nor on front page (the static page you may have defined as the home of your wordpress).
Then if you only want it on product pages there are a bunch of possibilities since there are a lot of product pages types (category page, single product page...).
But if you want it to display only on a few product pages type you could choose to display it only IF it's the good page type.
<?php
if (is_product())
echo 'your GTM code here';
?>
You will find woocommerce conditional tags here : https://docs.woocommerce.com/document/conditional-tags/ where you will be able to choose on which condition you want your GTM to display or not.
add a comment |
The easyest way not to display Google Tag Manager on Homepage is to check with php.
You can insert GTM in the header.php
file of your child-theme
like this:
<?php
if (!is_home() && !is_front_page())
echo 'your GTM code here';
?>
Will display GTM everywhere but on home (blog posts homepage) nor on front page (the static page you may have defined as the home of your wordpress).
Then if you only want it on product pages there are a bunch of possibilities since there are a lot of product pages types (category page, single product page...).
But if you want it to display only on a few product pages type you could choose to display it only IF it's the good page type.
<?php
if (is_product())
echo 'your GTM code here';
?>
You will find woocommerce conditional tags here : https://docs.woocommerce.com/document/conditional-tags/ where you will be able to choose on which condition you want your GTM to display or not.
The easyest way not to display Google Tag Manager on Homepage is to check with php.
You can insert GTM in the header.php
file of your child-theme
like this:
<?php
if (!is_home() && !is_front_page())
echo 'your GTM code here';
?>
Will display GTM everywhere but on home (blog posts homepage) nor on front page (the static page you may have defined as the home of your wordpress).
Then if you only want it on product pages there are a bunch of possibilities since there are a lot of product pages types (category page, single product page...).
But if you want it to display only on a few product pages type you could choose to display it only IF it's the good page type.
<?php
if (is_product())
echo 'your GTM code here';
?>
You will find woocommerce conditional tags here : https://docs.woocommerce.com/document/conditional-tags/ where you will be able to choose on which condition you want your GTM to display or not.
edited Jul 11 at 7:51
answered Jul 11 at 7:23
gaelgael
5861 silver badge9 bronze badges
5861 silver badge9 bronze badges
add a comment |
add a comment |
Thanks for contributing an answer to Webmasters Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fwebmasters.stackexchange.com%2fquestions%2f123938%2fhow-to-disable-a-code-in-gtm-from-firing-on-homepage%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown