Hi,
I have been asked to add this GA4 Code into every page after the Head tag.
I have not come across this before, Can it not be added in the functions.php only once?
Thanks
Hey woogie07,
Please try adding it to the Enfold Theme Options ▸ Google Services ▸ Google Analytics Tracking Code field.
If you really want to add it to your child theme functions.php add it into this function:
function custom_head_script() { ?>
<script>
//your code here
</script>
<?php
}
add_action('wp_head', 'custom_head_script', 10 );
Best regards,
Mike
hi,
I also need to add some script in the body tag
Is this located on the header.php or can it be added in Google Services?
Hi,
You can use this function in functions.php for that:
function woogie07_after_body_tag() {
?>
Your script goes here
<?php
}
add_action('ava_after_body_opening_tag', 'woogie07_after_body_tag');
Best regards,
Rikard
Thanks
Where does the code go within the function.php eg which line?
start/finish etc.
Is the private content correct