Puppet Class: ckan::ext::googleanalytics
- Defined in:
- manifests/ext/googleanalytics.pp
Summary
Installs the "googleanalytics" extension.Overview
Sends tracking data to Google Analytics and retrieves statistics from Google Analytics and inserts them into CKAN pages.
You should enable the “googleanalytics” plugin to use this extension.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'manifests/ext/googleanalytics.pp', line 30
class ckan::ext::googleanalytics (
String $id,
String $account,
String $username,
String $password,
Boolean $track_events = false,
String $revision = 'master',
) {
# need to install
# apt install libbz2-dev
# liblzma-dev
# python3 install rust
# python3 install setuptools_rust
ckan::ext { 'googleanalytics':
revision => $revision,
plugin => ['googleanalytics'],
}
# Google Analytics extension
ckan::conf::setting { 'googleanalytics.id':
value => $id,
require => Class['ckan::conf::production'],
}
ckan::conf::setting { 'googleanalytics.account':
value => $account,
require => Class['ckan::conf::production'],
}
ckan::conf::setting { 'googleanalytics.username':
value => $username,
require => Class['ckan::conf::production'],
}
ckan::conf::setting { 'googleanalytics.password':
value => $password,
require => Class['ckan::conf::production'],
}
ckan::conf::setting { 'googleanalytics.track_events':
value => $track_events,
require => Class['ckan::conf::production'],
}
# setup cron job to push events
if $track_events {
# run the cron every hour
cron { 'analystics_push_events':
command => "${ckan::paster} --plugin=ckan tracking update\
-c ${ckan::ckan_conf} && ${ckan::paster} --plugin=ckan\
search-index rebuild -r -c ${ckan::ckan_conf}",
hour => '*/1',
}
}
}
|