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?)
|
- Bulk process tracking requests (Redis or in-memory?)
|
||||||
- Allow sorting in table overviews.
|
- Allow sorting in table overviews.
|
||||||
- Choose a OS license & settle on name.
|
- Choose a OS license & settle on name.
|
||||||
- JS client for consuming API endpoints.
|
|
||||||
- Envelope API responses & perhaps return total in table overview?
|
- Envelope API responses & perhaps return total in table overview?
|
||||||
- Track canonical URL's.
|
- Track canonical URL's.
|
||||||
- Show referrals.
|
- Show referrals.
|
||||||
|
|
|
@ -5,8 +5,7 @@ import Client from '../lib/client.js';
|
||||||
import * as numbers from '../lib/numbers.js';
|
import * as numbers from '../lib/numbers.js';
|
||||||
|
|
||||||
import * as d3 from 'd3';
|
import * as d3 from 'd3';
|
||||||
import tip from 'd3-tip';
|
d3.tip = require('d3-tip');
|
||||||
d3.tip = tip;
|
|
||||||
|
|
||||||
const dayInSeconds = 60 * 60 * 24;
|
const dayInSeconds = 60 * 60 * 24;
|
||||||
|
|
||||||
|
|
|
@ -28,13 +28,23 @@ function setTrackerUrl(v) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function trackPageview() {
|
function trackPageview() {
|
||||||
|
// Respect "Do Not Track" requests
|
||||||
if( navigator.DonotTrack == 1 ) {
|
if( navigator.DonotTrack == 1 ) {
|
||||||
return;
|
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 = {
|
var d = {
|
||||||
|
h: location.hostname,
|
||||||
|
t: document.title,
|
||||||
l: navigator.language,
|
l: navigator.language,
|
||||||
p: location.pathname + location.search,
|
p: path,
|
||||||
sr: screen.width + "x" + screen.height,
|
sr: screen.width + "x" + screen.height,
|
||||||
t: document.title,
|
t: document.title,
|
||||||
r: document.referrer
|
r: document.referrer
|
||||||
|
@ -53,4 +63,6 @@ window.ana = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
// process existing queue
|
// 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) {
|
gulp.task('minify', function(cb) {
|
||||||
|
process.env.NODE_ENV = 'production';
|
||||||
|
|
||||||
pump([
|
pump([
|
||||||
gulp.src('./static/js/*.js'),
|
gulp.src('./static/js/*.js'),
|
||||||
uglify().on('error', gutil.log),
|
uglify().on('error', gutil.log),
|
||||||
|
|
Loading…
Reference in New Issue