mirror of https://github.com/status-im/fathom.git
include URL & title in tracking request
This commit is contained in:
parent
dabb89e863
commit
7d55a7b25a
|
@ -12,7 +12,6 @@ This is a general draft document for thoughts and todo's, without any structure
|
|||
- Bulk process tracking requests (Redis or in-memory?)
|
||||
- Allow sorting in table overviews.
|
||||
- Choose a OS license & settle on name.
|
||||
- JS client for consuming API endpoints.
|
||||
- Envelope API responses & perhaps return total in table overview?
|
||||
- Track canonical URL's.
|
||||
- Show referrals.
|
||||
|
|
|
@ -5,8 +5,7 @@ import Client from '../lib/client.js';
|
|||
import * as numbers from '../lib/numbers.js';
|
||||
|
||||
import * as d3 from 'd3';
|
||||
import tip from 'd3-tip';
|
||||
d3.tip = tip;
|
||||
d3.tip = require('d3-tip');
|
||||
|
||||
const dayInSeconds = 60 * 60 * 24;
|
||||
|
||||
|
|
|
@ -28,13 +28,23 @@ function setTrackerUrl(v) {
|
|||
}
|
||||
|
||||
function trackPageview() {
|
||||
// Respect "Do Not Track" requests
|
||||
if( navigator.DonotTrack == 1 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// get the path or canonical
|
||||
var path = location.pathname + location.search;
|
||||
var canonical = document.querySelector('link[rel="canonical"]');
|
||||
if(canonical && canonical.href) {
|
||||
path = canonical.href.substring(canonical.href.indexOf('/', 7)) || '/';
|
||||
}
|
||||
|
||||
var d = {
|
||||
h: location.hostname,
|
||||
t: document.title,
|
||||
l: navigator.language,
|
||||
p: location.pathname + location.search,
|
||||
p: path,
|
||||
sr: screen.width + "x" + screen.height,
|
||||
t: document.title,
|
||||
r: document.referrer
|
||||
|
@ -53,4 +63,6 @@ window.ana = function() {
|
|||
};
|
||||
|
||||
// process existing queue
|
||||
queue.map((i) => ana.apply(this, i));
|
||||
queue.forEach(function(i) {
|
||||
ana.apply(this, i);
|
||||
});
|
||||
|
|
|
@ -30,6 +30,8 @@ gulp.task('browserify', function () {
|
|||
});
|
||||
|
||||
gulp.task('minify', function(cb) {
|
||||
process.env.NODE_ENV = 'production';
|
||||
|
||||
pump([
|
||||
gulp.src('./static/js/*.js'),
|
||||
uglify().on('error', gutil.log),
|
||||
|
|
Loading…
Reference in New Issue