mirror of
https://github.com/LBRYFoundation/lbry.com.git
synced 2025-08-23 17:47:26 +00:00
tracking to matomo
This commit is contained in:
parent
fdd0937e51
commit
882ebcc658
2 changed files with 20 additions and 2 deletions
|
@ -22,6 +22,20 @@
|
||||||
fbq('track', '<?php echo Response::getFacebookPixelAnalyticsType() ?>');
|
fbq('track', '<?php echo Response::getFacebookPixelAnalyticsType() ?>');
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
var _paq = window._paq || [];
|
||||||
|
_paq.push(['trackPageView']);
|
||||||
|
_paq.push(['enableLinkTracking']);
|
||||||
|
_paq.push(['setLinkTrackingTimer', 750]); // increase to 750 milliseconds
|
||||||
|
(function() {
|
||||||
|
var u="https://analytics.lbry.com/";
|
||||||
|
_paq.push(['setTrackerUrl', u+'matomo.php']);
|
||||||
|
_paq.push(['setSiteId', '2']);
|
||||||
|
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
|
||||||
|
g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<script>
|
<script>
|
||||||
window.ga = function() {};
|
window.ga = function() {};
|
||||||
|
|
|
@ -8,8 +8,12 @@ $(document).ready(function() {
|
||||||
function onAnchorClick() {
|
function onAnchorClick() {
|
||||||
var anchor = $(this);
|
var anchor = $(this);
|
||||||
|
|
||||||
if (anchor.data('analytics-category') && anchor.data('analytics-action') && anchor.data('analytics-label') && window.ga) {
|
if (anchor.data()['analyticsCategory'] && anchor.data()['analyticsAction'] && anchor.data()['analyticsLabel'] && window.ga) {
|
||||||
ga('send', 'event', anchor.data('analytics-category'), anchor.data('analytics-action'), anchor.data('analytics-label'));
|
ga('send', 'event', anchor.data()['analyticsCategory'], anchor.data()['analyticsAction'], anchor.data()['analyticsLabel']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (anchor.data()['analyticsCategory'] && anchor.data()['analyticsAction'] && anchor.data()['analyticsLabel'] && window._paq) {
|
||||||
|
_paq.push(['trackEvent', anchor.data()['analyticsCategory'], anchor.data()['analyticsAction'], anchor.data()['analyticsLabel']]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Reference in a new issue