Skip to content

Commit 5ba1158

Browse files
Merge pull request #23 from MITLibraries/post-36
Add static Matomo integration to theme
2 parents e44cf65 + 6c12410 commit 5ba1158

3 files changed

Lines changed: 13 additions & 7 deletions

File tree

asset/js/matomo.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
var _paq = window._paq = window._paq || [];
2+
/* tracker methods like 'setCustomDimension' should be called before 'trackPageView' */
3+
_paq.push(['trackPageView']);
4+
_paq.push(['enableLinkTracking']);
5+
(function() {
6+
var u='https://matomo.libraries.mit.edu/';
7+
_paq.push(['setTrackerUrl', u+'matomo.php']);
8+
_paq.push(['setSiteId', '9']);
9+
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
10+
g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
11+
})();

config/theme.ini

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@ omeka_version_constraint = "^4.0.0"
1010
helpers[] = "FooterHelper"
1111

1212
[config]
13-
elements.analytics_property.name = "analytics_property"
14-
elements.analytics_property.type = "Text"
15-
elements.analytics_property.options.label = "Analytics Property ID"
16-
elements.analytics_property.options.info = "This is the Matomo property ID, and can be provided by UXWS"
17-
1813
elements.banner.name = "banner"
1914
elements.banner.type = "Omeka\Form\Element\Asset"
2015
elements.banner.options.label = "Site banner"

view/layout/layout.phtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?php
22
$translate = $this->plugin('translate');
3-
$analytics_property = $this->themeSetting('analytics_property');
43
$banner_url = $this->themeSettingAssetUrl('banner');
54
$banner_text = $this->themeSetting('banner_text');
65

@@ -26,6 +25,7 @@ $this->headScript()->prependFile($this->assetUrl('vendor/jquery/jquery.min.js',
2625
$this->headScript()->appendFile($this->assetUrl('js/global.js', 'Omeka'));
2726
$this->headScript()->appendFile($this->assetUrl('js/smartmenus/dist/jquery.smartmenus.min.js'));
2827
$this->headScript()->appendFile($this->assetUrl('js/tesseract.js'));
28+
$this->headScript()->appendFile($this->assetUrl('js/matomo.js'));
2929
$this->trigger('view.layout');
3030
$userBar = $this->userBar();
3131
?>
@@ -97,7 +97,7 @@ $userBar = $this->userBar();
9797
<?php echo $this->partial('common/footer-site-slim'); ?>
9898
</div>
9999
<footer>
100-
<?php echo $this->FooterHelper($analytics_property); ?>
100+
<?php echo $this->FooterHelper(''); ?>
101101
<span class="powered-by"><?php echo $translate('Powered by Omeka S'); ?></span>
102102
</footer>
103103
</body>

0 commit comments

Comments
 (0)