Adding Google Analytics Code in WordPress Website Php Tricks by Rajesh Kumar Sahanee - August 24, 2017April 6, 20200 Post Views: 5,007 Hello Friends today I am going to share how to add google analytics code on your wordpress website using hooks in functions.php, To do so you can use wp_head hook. The wp_head action hook is triggered within the <head></head> tag. You can also use lots of available plugins but that makes your website heavy so for small features/functionality it is better to use fuctions.php. So here is the code funcions.php PHP //Google Anylytics Tracking Code add_action( 'wp_head', 'analytics_tracking_code' ); function analytics_tracking_code() { ?> <script> //paste your google analytics tracking code here </script> <?php } 12345678910 //Google Anylytics Tracking Codeadd_action( 'wp_head', 'analytics_tracking_code' );function analytics_tracking_code() {?><script> //paste your google analytics tracking code here </script><?php} Thanks 🙂 Please share if you like it