Tracking Code for Google Analytics

Tracking Code for Google Analytics Install Statistics

11
100%
Today: 11 Yesterday: 0 All-time: 3,175 downloads
Tracking Code for Google Analytics Icon

Try plugin: Tracking Code for Google Analytics

We'll create fresh WordPress site with Tracking Code for Google Analytics installed. You have 20 minutes to test the plugin after that site we'll be deleted.

Takes ~10 seconds to install.

About Tracking Code for Google Analytics

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

0


0


0


0


0

updated: 2 years ago
since: 4 years ago
author: Clayton Collie

Description

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.