Kirby GA - Google Analytics
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
docs
lib
registry
README.md
kirby-ga.php
package.json

README.md

Kirby GA

Verion 0.2

Google Analytics for Kirby CMS.

  • Doesn't run the GA script on localhost.
  • Doesn't run the GA script if you are logged in.

Table of contents

Usage

  1. Add the config plugin.ga.id to config.php.
  2. Add the code below to your footer snippet.
<?php snippet('ga'); ?>

Options

Only the plugin.ga.id is required.

c::set('plugin.ga.id', '');
c::set('plugin.ga', true);
c::set('plugin.ga.blacklist', [ '127.0.0.1', '::1' ] );
c::set('plugin.ga.debug', false);
c::set('plugin.ga.snippet', 'ga');

plugin.ga.id (required)

The Google Analytics ID. Set it to something like UA-12345678-12.

c::set('plugin.ga.id', '');

plugin.ga

You can deactivate the script by setting this value to false.

c::set('plugin.ga', true);

plugin.ga.blacklist

Localhost is in the blacklist as default. You can change it.

c::set('plugin.ga.blacklist', [ '127.0.0.1', '::1' ] );

plugin.ga.debug

The script is only active for not logged in users and users not on localhost.

If you want to always run the script, set this option to true.

c::set('plugin.ga.debug', false);

plugin.ga.snippet

Change the snippet name with this option. You can override the snippet as well.

c::set('plugin.ga.snippet', 'ga');

Requirements

Disclaimer

This plugin is provided "as is" with no guarantee. Use it at your own risk and always test it yourself before using it in a production environment. If you find any issues, please create a new issue.

License

MIT

It is discouraged to use this plugin in any project that promotes racism, sexism, homophobia, animal abuse, violence or any other form of hate speech.

Credits