• Greetings to everyone

    I am new to WP and have purchased a Woocommerce theme and using Elementor to customize it. I added google tracking code in header.php

    I am not sure whether I need to create a child theme and what files should go in it to add the google tracking code and keep any customizations I am doing on the theme.

    If you could please share any resources or advice I’d really appreciate it

    Thank you

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello,

    The GA code is on the right place now but when you download an update for your theme it will remove the code from the header.php.

    So using child theme is a better solution.

    If you got it for your theme, upload it and activate. After it you can copy the header.php from the original theme (and modify it) , or the best solution you integrate it into the functions.php

    https://developer.ww.wp.xz.cn/themes/basics/including-css-javascript/

    Tom Miletics

    Thread Starter moepolska

    (@moepolska)

    Hi Tom thank so much for feedback. Do I need to add the GA code in both header.php and functions.php in child theme?

    I still haven’t created a child theme. I’ll activate child theme configurator plugin and go about it.

    Moe

    • This reply was modified 4 years, 9 months ago by moepolska.

    Hello,

    Didn't you get a child-theme (zip) for your theme?
    
    child theme means about an "empty" theme where you can overwrite functions of the original theme. (usually there is 3 files , style.css, functions.php, screenshot.jpg)
    
    in this case in the functions.php in the child-theme you can add the GA code and you dont't have to copy or modifiy the header.php files.

    Tom M

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘The right place for google tracking code’ is closed to new replies.