jinsley8 / wp-google-analytics

Add Google Analytics script in a WordPress without tracking logged-in Admin users

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

WP Google Analytics

Use this to include your Google Analytics script in a WordPress child theme without tracking logged-in Admin users.

Install

Make an /inc folder in your child theme if one doesn't exist and place google-analytics.php within folder.

Next, we need to require the google-analytics.php file in your function.php file.

require_once( 'inc/google-analytics.php' );

Replace UA-XXXXX-Y with your own UA property.

Google Analytics 4

If using the new GA4, replace G-XXXXX with your own GA4 Measurement ID and uncomment line 18.

About

Add Google Analytics script in a WordPress without tracking logged-in Admin users


Languages

Language:PHP 100.0%