visuellverstehen / t3googleanalytics
An easy and basic Google Analytics extension for TYPO3.
Installs: 7 678
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 7
Forks: 0
Open Issues: 1
Type:typo3-cms-extension
Requires
- php: ^7.0 || ^8.0
- typo3/cms-core: 7.6 - 11.5
README
t3googleanalytics
An easy and basic Google Analytics extension for TYPO3.
How to use
- Install TYPO3 extension via composer, TER or download and install manually.
- Configure the extension
- Call
googleAnalyticsDisable()
orgoogleAnalyticsEnable()
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.
- Add the tracking ID within the sys_template row via the backend module
- 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';
- 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 withonclick="return googleAnalyticsDisable();"