Comments (7)
enableLinkTracking
is added by default with this plugin and I found this automatic outlink/download link tracking covering most use cases. For me, the Behavior > Outlinks
& Behavior > Downloads
lists in Matomo get populated as expected.
But that automatic detection is based on a pre-defined list of file extensions Matomo uses to detect download links. Are you using any other extension than in this list maybe? If so I could add an option to add more file extensions for the automatic link tracking.
7z|aac|arc|arj|apk|asf|asx|avi|bin|bz|bz2|csv|deb|dmg|doc|
exe|flv|gif|gz|gzip|hqx|jar|jpg|jpeg|js|mp2|mp3|mp4|mpg|
mpeg|mov|movie|msi|msp|odb|odf|odg|odp|ods|odt|ogg|ogv|
pdf|phps|png|ppt|qt|qtm|ra|ram|rar|rpm|sea|sit|tar|
tbz|tbz2|tgz|torrent|txt|wav|wma|wmv|wpd||xls|xml|z|zip
For full manual control you could always use the tracker object on window
directly, like:
<a href="/static/somefile.zip" download onClick={() => window._paq.push(['trackLink', 'https://myurl.com/static/somefile.zip', 'download'])}>Download</a>
But that's rather cumbersome obviously
from gatsby-plugin-matomo.
good point @samajammin, enableLinkTracking
is not added to the initial generated static page, but fired on client-side only in gatsby-browser.js for every route change on Gatsby's onRouteUpdate
trigger: https://github.com/kremalicious/gatsby-plugin-matomo/blob/master/src/gatsby-browser.js#L36
I based this on somewhat of an educated guess, where I understood that for a single page application Matomo needs that so not only links on the initial page are tracked, but also on subsequent visited pages. And a user arriving on the first landing page will fire onRouteUpdate
, which will then actually record the first page view hit, and enable link tracking for that route.
That being said, I never fully explored link tracking since it seemed to just work with that implementation. There's probably a case to be made, which needs to be verified and tested, to put enableLinkTracking
within the initial tracking code and see how Gatsby behaves with its static and hydrated pages. So I'll keep this issue open for now in case anybody else has some experiences to share, thanks everyone so far for reporting back!
from gatsby-plugin-matomo.
Following up on this for folks who are curious.
Since migrating our site to Gatsby (& using this Matomo plugin) on 6/25, we have seen a significant jump (~2x) in outlinks:
This would support your theory @kremalicious that link tracking should be enabled on every route change, though I'm not sure how to verify this.
from gatsby-plugin-matomo.
I think this would be covered by #2
from gatsby-plugin-matomo.
Thanks for clarifying.
I found what the problem was: The downloads were hidden inside a foldout component. After switching to "hidden" instead of not rendering, it worked.
from gatsby-plugin-matomo.
Thanks @kremalicious!
enableLinkTracking
is added by default with this plugin
I'm curious why I can't see it in the script code.
Here's the snippet I have in a <script>
tag on my old site:
var _paq = window._paq || [];
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
...
})();
Inspecting the DOM in dev
mode with this plugin, I'm not seeing it:
window.dev = true
if (window.dev === true || !(navigator.doNotTrack === '1' || window.doNotTrack === '1')) {
window._paq = window._paq || [];
window._paq.push(['setTrackerUrl', 'https://matomo.ethereum.org/matomo.js/matomo.php']);
window._paq.push(['setSiteId', '4']);
window._paq.push(['enableHeartBeatTimer']);
window.start = new Date();
(function() {
...
}
}
Is it being configured under the hood somewhere?
from gatsby-plugin-matomo.
Thanks for the quick response & explanation @kremalicious!
FWIW, the previous site used VuePress & the outlink tracking appeared to working when added to just the initial generated static page. Perhaps the only tracking we had was when the user landed on that given page though, so I can't verify if that's the correct approach.
I'll keep an eye on our data with this new configuration & let you know if this shows similar results or not.
from gatsby-plugin-matomo.
Related Issues (18)
- Wrong page title when navigating HOT 3
- Option to ignore Do-Not-Track and/or to track anonymous data HOT 2
- An in-range update of release-it is breaking the build 🚨 HOT 2
- `sendPageView` should be called via `requestAnimationFrame`, when available HOT 1
- Support JavaScript error tracking
- Javascript load event causing incorrect "Bounce Rate" in Matomo reports HOT 1
- random 404 error with "_pk_ref"
- outbound link tracking
- Tracking don't work HOT 2
- Support for Gatsby 4 HOT 1
- Add option to disable JavaScript load duration HOT 2
- requireConsent mode
- [email protected]
- Support custom event tracking HOT 1
- Channel misattribution?
- Matomo opt-out in cookieless mode
- exclude option could be a regex ?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gatsby-plugin-matomo.