diff options
author | ArthurHoaro <arthur@hoa.ro> | 2017-03-11 13:52:00 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-11 13:52:00 +0100 |
commit | 1739d6b314f410ee79d603f601f2845d55c48b4d (patch) | |
tree | c9b1bcc7c6461f8d1846f376d2b94adadceed6e4 /plugins/piwik | |
parent | 844021ab4c0d3dd6c26704648a736fa53244c914 (diff) | |
parent | fe83d45c465bad94709ce5aacf7acad47ad75077 (diff) | |
download | Shaarli-1739d6b314f410ee79d603f601f2845d55c48b4d.tar.gz Shaarli-1739d6b314f410ee79d603f601f2845d55c48b4d.tar.zst Shaarli-1739d6b314f410ee79d603f601f2845d55c48b4d.zip |
Merge pull request #799 from ArthurHoaro/plugins/piwik-url
Fix #773: set Piwik URL protocol
Diffstat (limited to 'plugins/piwik')
-rw-r--r-- | plugins/piwik/piwik.html | 15 | ||||
-rw-r--r-- | plugins/piwik/piwik.php | 23 |
2 files changed, 22 insertions, 16 deletions
diff --git a/plugins/piwik/piwik.html b/plugins/piwik/piwik.html new file mode 100644 index 00000000..0881d7c8 --- /dev/null +++ b/plugins/piwik/piwik.html | |||
@@ -0,0 +1,15 @@ | |||
1 | <!-- Piwik --> | ||
2 | <script type="text/javascript"> | ||
3 | var _paq = _paq || []; | ||
4 | _paq.push(['trackPageView']); | ||
5 | _paq.push(['enableLinkTracking']); | ||
6 | (function() { | ||
7 | var u="%s/"; | ||
8 | _paq.push(['setTrackerUrl', u+'piwik.php']); | ||
9 | _paq.push(['setSiteId', '%s']); | ||
10 | var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; | ||
11 | g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s); | ||
12 | })(); | ||
13 | </script> | ||
14 | <noscript><p><img src="%s/piwik.php?idsite=%s" style="border:0;" alt="" /></p></noscript> | ||
15 | <!-- End Piwik Code --> \ No newline at end of file | ||
diff --git a/plugins/piwik/piwik.php b/plugins/piwik/piwik.php index 7c44909c..4a2b48a1 100644 --- a/plugins/piwik/piwik.php +++ b/plugins/piwik/piwik.php | |||
@@ -50,22 +50,13 @@ function hook_piwik_render_footer($data, $conf) | |||
50 | } | 50 | } |
51 | 51 | ||
52 | // Free elements at the end of the page. | 52 | // Free elements at the end of the page. |
53 | $data['endofpage'][] = '<!-- Piwik -->' . | 53 | $data['endofpage'][] = sprintf( |
54 | '<script type="text/javascript">' . | 54 | file_get_contents(PluginManager::$PLUGINS_PATH . '/piwik/piwik.html'), |
55 | ' var _paq = _paq || [];' . | 55 | $piwikUrl, |
56 | ' _paq.push([\'trackPageView\']);' . | 56 | $piwikSiteid, |
57 | ' _paq.push([\'enableLinkTracking\']);' . | 57 | $piwikUrl, |
58 | ' (function() {' . | 58 | $piwikSiteid |
59 | ' var u="//' . $piwikUrl . '/";' . | 59 | ); |
60 | ' _paq.push([\'setTrackerUrl\', u+\'piwik.php\']);' . | ||
61 | ' _paq.push([\'setSiteId\', \'' . $piwikSiteid . '\']);' . | ||
62 | ' var d=document, g=d.createElement(\'script\'), s=d.getElementsByTagName(\'script\')[0];' . | ||
63 | ' g.type=\'text/javascript\'; g.async=true; g.defer=true; g.src=u+\'piwik.js\'; s.parentNode.insertBefore(g,s);' . | ||
64 | ' })();' . | ||
65 | '</script>' . | ||
66 | '<noscript><p><img src="//' . $piwikUrl . '/piwik.php?idsite=' . $piwikSiteid . '" style="border:0;" alt="" /></p></noscript>' . | ||
67 | '<!-- End Piwik Code -->'; | ||
68 | 60 | ||
69 | return $data; | 61 | return $data; |
70 | } | 62 | } |
71 | |||