visuellverstehen/t3googleanalytics

An easy and basic Google Analytics extension for TYPO3.

Installs: 6 481

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 7

Forks: 0

Open Issues: 1

Type:typo3-cms-extension

0.4.1 2021-03-23 08:35 UTC

This package is auto-updated.

Last update: 2021-06-23 09:07:35 UTC


README

Actions Downloads

t3googleanalytics

An easy and basic Google Analytics extension for TYPO3.

How to use

  1. Install TYPO3 extension via composer, TER or download and install manually.
  2. Configure the extension
  3. Call googleAnalyticsDisable() or googleAnalyticsEnable() via JavaScript to disable or enable Google Analytics. By default it is enabled. The user can disable tracking with a simple button which can look like this: <a onclick="return googleAnalyticsDisable();">Disbale GA Opt Tracking</a>

Configure the extension

There are several options to add your tracking id. The following list will show you all options in the prioritized order.

  1. Add the tracking ID within the sys_template row via the backend module

screenshot of the new field inside the template backend module

  1. When you add your template through the runThroughTemplatesPostProcessing hook add the tracking ID like so:
// $row is your template record array
$row['constants'] .= 'google_analytics_tracking_id = UA-11111111-1';
  1. Add the tracking ID directly to the settings section inside your site configuration file:
settings:
  googleAnalyticsTrackingId: UA-11111111-1

Tips

  • To allow onclick events within CKEditor add extraAllowedContent: '*(*)[onclick]' to your CKEditor configuration file. Then you can add a link with onclick="return googleAnalyticsDisable();"