Download the PHP package wearerequired/required-google-analytics without Composer

On this page you can find all versions of the php package wearerequired/required-google-analytics. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package required-google-analytics

Google Analytics

A lightweight WordPress plugin to add Google's global site tag (gtag.js) to your site, the modern way.

The modern way? The script is added with support for preloading, which will provide a small performance boost on modern browsers.
Modern browsers are those that support the async script attribute. This does not include IE 9 and older mobile browsers.

You can use this plugin with Universal Analytics or Google Analytics 4 properties or, to help ease the transition period, dual tagging is also supported.

Beside that, the plugin doesn't do more. No fancy report view in your admin, no authentication requirements, no additional scripts, and no ads for random blog posts.

Installation

Install via Composer

$ composer require wearerequired/required-google-analytics

Add you property ID at Settings > Reading > Google Analytics.

Disable Analytics for opted-out users

The plugin provides a function to let users opt out of Google Analytics measurement. If the function window.requiredGADoOptOut() is called a ga-opted-out item is stored in the local browser storage and the window property window['ga-disable-PROPERTY_ID'] will be set to true.

Example:

<a href="#" onclick="requiredGADoOptOut();return false">Opt-out from Google Analytics for this site.</a>

Event Tracking for Universal Analytics

The plugin provides a small layer that transform data attributes on an HTML element to a Google Analytics event. To enable the layer use the following filter:

add_filter( 'required_ga.enable_event_tracking', '__return_true' );

To track the click event of a button you can now use the following data attributes:

Example usage:

<button data-ga-event-action="xyz">Click me!</button>

<button data-ga-event-action="play_video" data-ga-event-category="engagement">Click me!</button>

Additional Config Info

To configure custom dimensions and metrics you can use the required_ga.additional_config_info filter. By default the forceSSL and anonymizeIp fields are set to true.

Example usage:

add_filter( 'required_ga.enable_event_tracking', function( $config ) {
    $config['custom_map'] = [
        'dimension1' => 'author',
    ];

    if ( is_singular( 'post' ) ) {
        $config['author'] = get_the_author_meta( 'display_name', get_post()->post_author )
    }

    return $config;
} );

Support for analytics.js (Universal Analytics)

Starting with version 2.0 the plugin enqueues gtag.js. If you need support for analytics.js you can continue using the 1.x branch.

$ composer require wearerequired/required-google-analytics:"^1.0"

All versions of required-google-analytics with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
wearerequired/traduttore-registry Version ^1.0 || ^2.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package wearerequired/required-google-analytics contains the following files

Loading the files please wait ....