• How can I add Google Analytics code the header/php? With astra I used hooks, but don’t see an option like that. And, I’d like to avoid plugin. Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi @rjoyner,

    Thanks for getting in touch with us.

    I am afraid we don’t have any option through which you can add Google Analytics code, however, you can add it by using the below code in functions.php

    function add_head_meta() {
     // Put the google analytics code here
    }
    add_action( 'wp_head', 'add_head_meta');

    I would suggest you to add the code by creating the child theme so that it can work even after updates.

    Have a nice day!

    Thread Starter rjoyner

    (@rjoyner)

    thanks, but that crashed the site. Can you add any other info that may avoid this?

    Hi @rjoyner,

    Sorry for the inconvenience caused to you.

    I am not able to replicate the issue on my site. I request you open a support ticket from here:https://wpspectra.com/support/ so that our support dev can help better.

    Have a nice day!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘GA code’ is closed to new replies.