Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #398546

    Hi,

    I’d like to place a snippet of code on each page of my site for tracking purposes using a service called LuckyOrange.

    How do I add their snippet on each page without affecting the layout of each page?

    I tried adding a code block element to the bottom of a page, but it results in showing an empty white bar between the last element and the footer, which I wouldn’t want to have.

    See: https://casateulada.com/about (scroll down to the bottom and note the blank stack between the fullwidth button and the two footer widgets

    Thank you.

    Antonio

    #398601

    Hi Antonio!

    You can use a WordPress Hook, in this case i’d suggest using wp_footer, add the following to theme / child theme functions.php:

    function tracking_code() {
    ?>
    PUT THE CODE HERE
    <?php
    }
    add_action('wp_footer', 'tracking_code');
    

    Best regards,
    Josue

    #398959

    Thank you Josue!

    I’ll do that. I also noticed that if I place a code block element inside a coloured background element, let’s say below a contact form, this will not show anything on the life site, so I tried that on the other pages of my site while waiting for your answer.

    Do you reckon that such a solution would work too?

    Antonio

    #399132

    Hi Antonio,

    Either solution will work but i’d suggest using a hook so you wouldn’t need to put the code in every page.

    Regards,
    Josue

    #399598

    thanks, you can mark this as solved.

    best,

    Antonio

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘How to add code to each page?’ is closed to new replies.