Google conversion code? Do you mean the analytics code?
It’s actually conversion code but it’s a similar script to analytics.
I want to be able to put this on say like a order confirmation page or such.
I need to be able to get into a specific pages template I guess so that I can access the </body> tag
You could try using the is_page conditional
<?php if( is_page('Foobar') ) :?>
[ google code ]
<?php endif;?>
Not sure if that will work or not.
I’ll need to put different code on each page as well so in essence I will have
code 1 on page 1
code 2 on page 2
etc…
As from google, it has to go:
<body>
Paste the code between the body tags of your conversion pages.
</body>
I guess I’m just trying to find where the </body> tag would be on not only the index page but individual pages as well. Not seeming to find it but of course, I’m used to regular html not php which is probably the problem.
thanks so much for your help on this btw
The </body> tag will be in footer.php.
I just spotted that after I replied the last time.
That’s where the analytics code is although it was put there by a plugin “google analytics for wordpress”
So now that’s going to be on all pages.
Is there a way to access each individual page on your site like this?
Maybe I’m missing something with your original comment about the ‘is___’ function
For individual page you can use the conditional tags as esmi told above. But as the number of pages increase it turns out to be a problem.
The usual way is to use is_page() to determine what to add to which page. But I agree – with a lot of pages and page-specific code being needed for each one – is_page() isn’t exactly practical.
How many pages are we talking about?
actually only 2 or 3 pages that the code would need to go on no matter how many webpages the website has.
for the number of total pages on the site, I have a couple that I’m doing this for so anywhere from 5 to 50.
For 1 – 6 pages, I’d say that is_page would be the best option. Over 6 and it’s getting clunky. 20 or 30 and you’ll start to hit slowdown. Saw a site the other week with about 50 is_page() conditionals in just one function. It was slowing down…
well for a couple of sites it should work then.
any other thoughts on how to make it work?
Um… look at the Pods or Flutter plugins?