Hi, my website uses the roots theme and my boss wanted me to install a tracking pixel on our website. The instructions to install it say to enter it right before the </body>
tag on the footer.php. I’ve been searching my website and don’t see that tag anywhere in the footer. Please help me figure out this problem. Thank you!
Do you mean google analytics? Or what tracking pixel are you referring to?
Sorry i forgot to specify. Its a javascript pixel from a site called adroll
What tag? </body>
? Just open up base.php
& next time try searching the actual files in the theme
I tried that earlier in the base.php but it still wasnt firing
You would have to put the image in every base-*.php
file. This is fine if you’re starting a new theme but if you already have a few different bases you could hook an action to wp_footer
instead:
function namespace_add_tracking_pixel() {
echo '<img src="../tracking/rockwell.png">';
}
add_action('wp_footer', 'namespace_add_tracking_pixel', 1000);
I’m sorry i"m really new at wordpress stuff. Where would that program go? and also where do I insert the code for the pixel?
And when you say every base.php does that just mean I have to put that into every base.php for each theme that is eneabled?
The function should go in lib/custom.php
or functions.php
. You can also add the script to the function if you like, but it depends on what the guidance is on adroll.
still very confused. It’s definitely my fault; I’m really not well-versed in wordpress at all. I’m gonna try and put in your function though thank you for that