WPThumbs
Themes Plugins By purpose By industry Best-of lists Fix it guides
Free Plugin by Clayton Collie v2.0.3

Tracking Code for Google Analytics

Simple, lightweight solution for inserting your Google Analytics Universal tracking code.

Tracking Code for Google Analytics

The facts

Active installs
100+
Price
Free
Last updated
5 Jul 2024
Added
Oct 2020
Requires WP
5.0
Tested up to
WP 6.6.0
Requires PHP
7.2
Downloads
5,607

Our analysis

AI-assisted

Tracking Code for Google Analytics is a WordPress plugin designed to insert the Google Analytics Universal Analytics tracking code into your website's header. It provides a straightforward way to add your tracking ID through the settings interface or by defining it in the wp-config.php file.

This plugin is suitable for users who want a simple solution for integrating Google Analytics without additional features or complexity. It is lightweight and focuses solely on its primary function of adding the tracking code.

Best for: This plugin is best for website owners looking for a straightforward way to integrate Google Analytics.

What it does well

  • Lightweight and simple to use
  • Inserts Google Analytics tracking code into the website header
  • Allows tracking ID to be set via user interface or code

Where it falls short

  • Limited functionality, only inserts tracking code
  • No published rating or extensive user feedback available

Verdict

Tracking Code for Google Analytics is a basic tool for adding tracking code, suitable for users who need minimal functionality. Its simplicity may appeal to those who do not require advanced analytics features.

From the developer

Clayton Collie's own description of Tracking Code for Google Analytics, lightly tidied.

Tracking Code For Google Analytics is a simple, lightweight WordPress plugin for inserting your Google Analytics Universal Analytics tracking code. The plugin does one thing and one thing only; prints the standard Google Analytics tacking script to the <head> of your website. To insert your tracking ID, navigate to Settings > General and then scroll to the bottom of the page.

Composer

composer require claytoncollie/tracking-code-for-google-analytics

Filters

If you want to set the tracking ID without using the wp-admin user interface, use the filter below.

add_filter(
    'tracking_code_for_google_analytics_id',
    /**
     * Set Google Analytics tracking ID.
     *
     * @param string $tracking_id Tracking ID.
     *
     * @return string
     */
    function ( string $tracking_id ) : string {
        $tracking_id = 'UA-7654321';
        return $tracking_id;
    }
);

Definitions

You can also define the tracking ID in your wp-config.php file with the following snippet.

define( 'TRACKING_CODE_FOR_GOOGLE_ANALYTICS_ID', 'UA-7654321' );

Contributing

While the purpose of this plugin is to be very tightly scoped, issues and pull requests are welcome on GitHub. I do not guarantee that everything will be merged or support will be given.

Donate

If you like this plugin and would like to support my work, please consider a small donation via Coinbase.

Read the full description on the official page →

Tagged as

Alternatives

Other plugins for measuring traffic.

Under Construction

Easy to use Under Construction Page &amp; Coming Soon Page. Enable Under Construction Mode in seconds &amp; sh...

Free 600k+ installs 4.8★ (1,285)
Ad Inserter

Manage Google AdSense ads, banners, ad rotation, sticky widgets, AMP ads, ads.txt, tracking, header and footer...

Free 300k+ installs 4.9★ (2,428)
MonsterInsights

The best free Google Analytics plugin for WordPress. See how visitors find and use your website so you can gro...

Free 2M+ installs 4.5★ (3,148)
Maintenance

Great looking maintenance, coming soon &amp; under construction pages. Put your site under maintenance in minu...

Free 1M+ installs 4.4★ (860)
Header Footer Code Manager

Easily add tracking code snippets, conversion pixels, or other scripts required by third party services for an...

Free 600k+ installs 4.9★ (309)
GA Google Analytics

Adds Google Analytics tracking code to your WordPress site. Supports many tracking features.

Free 400k+ installs 4.9★ (158)