added barista
parent
de70b00f42
commit
534790bd41
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
# production
|
# production
|
||||||
/build
|
/build
|
||||||
/public/umami.js
|
/public/barista.js
|
||||||
/public/geo
|
/public/geo
|
||||||
/public/lang
|
/public/lang
|
||||||
/lang-compiled
|
/lang-compiled
|
||||||
|
|
|
@ -24,7 +24,7 @@ export default function TrackingCodeForm({ values, onClose }) {
|
||||||
rows={3}
|
rows={3}
|
||||||
cols={60}
|
cols={60}
|
||||||
spellCheck={false}
|
spellCheck={false}
|
||||||
defaultValue={`<script async defer data-website-id="${values.website_uuid}" src="${document.location.origin}${basePath}/umami.js"></script>`}
|
defaultValue={`<script async defer data-website-id="${values.website_uuid}" src="${document.location.origin}${basePath}/barista.js"></script>`}
|
||||||
readOnly
|
readOnly
|
||||||
/>
|
/>
|
||||||
</FormRow>
|
</FormRow>
|
||||||
|
|
|
@ -39,7 +39,7 @@ export default function TestConsole() {
|
||||||
<Page>
|
<Page>
|
||||||
<Head>
|
<Head>
|
||||||
{typeof window !== 'undefined' && website && (
|
{typeof window !== 'undefined' && website && (
|
||||||
<script async defer data-website-id={website.website_uuid} src="/umami.js" />
|
<script async defer data-website-id={website.website_uuid} src="/barista.js" />
|
||||||
)}
|
)}
|
||||||
</Head>
|
</Head>
|
||||||
<PageHeader>
|
<PageHeader>
|
||||||
|
|
|
@ -19,7 +19,7 @@ module.exports = {
|
||||||
async headers() {
|
async headers() {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
source: '/umami.js',
|
source: '/barista.js',
|
||||||
headers: [
|
headers: [
|
||||||
{
|
{
|
||||||
key: 'Cache-Control',
|
key: 'Cache-Control',
|
||||||
|
|
|
@ -6,7 +6,7 @@ import { terser } from 'rollup-plugin-terser';
|
||||||
export default {
|
export default {
|
||||||
input: 'tracker/index.js',
|
input: 'tracker/index.js',
|
||||||
output: {
|
output: {
|
||||||
file: 'public/umami.js',
|
file: 'public/barista.js',
|
||||||
format: 'iife',
|
format: 'iife',
|
||||||
},
|
},
|
||||||
plugins: [resolve(), buble({ objectAssign: true }), terser({ compress: { evaluate: false } })],
|
plugins: [resolve(), buble({ objectAssign: true }), terser({ compress: { evaluate: false } })],
|
||||||
|
|
|
@ -25,7 +25,7 @@ import { removeTrailingSlash } from '../lib/url';
|
||||||
const domains = attr('data-domains');
|
const domains = attr('data-domains');
|
||||||
|
|
||||||
const disableTracking =
|
const disableTracking =
|
||||||
localStorage.getItem('umami.disabled') ||
|
localStorage.getItem('cappuccino.disabled') ||
|
||||||
(dnt && doNotTrack()) ||
|
(dnt && doNotTrack()) ||
|
||||||
(domains &&
|
(domains &&
|
||||||
!domains
|
!domains
|
||||||
|
@ -39,7 +39,7 @@ import { removeTrailingSlash } from '../lib/url';
|
||||||
const screen = `${width}x${height}`;
|
const screen = `${width}x${height}`;
|
||||||
const listeners = [];
|
const listeners = [];
|
||||||
let currentUrl = `${pathname}${search}`;
|
let currentUrl = `${pathname}${search}`;
|
||||||
let currentRef = document.referrer;
|
let currentRef = document.referrer || new URLSearchParams(window.location.search).get('r');
|
||||||
|
|
||||||
/* Collect metrics */
|
/* Collect metrics */
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ import { removeTrailingSlash } from '../lib/url';
|
||||||
const collect = (type, params, uuid) => {
|
const collect = (type, params, uuid) => {
|
||||||
if (disableTracking) return;
|
if (disableTracking) return;
|
||||||
|
|
||||||
const key = 'umami.cache';
|
const key = 'cappuccino.cache';
|
||||||
|
|
||||||
const payload = {
|
const payload = {
|
||||||
website: uuid,
|
website: uuid,
|
||||||
|
@ -110,9 +110,9 @@ import { removeTrailingSlash } from '../lib/url';
|
||||||
/* Handle events */
|
/* Handle events */
|
||||||
|
|
||||||
const addEvents = () => {
|
const addEvents = () => {
|
||||||
document.querySelectorAll("[class*='umami--']").forEach(element => {
|
document.querySelectorAll("[class*='cappuccino--']").forEach(element => {
|
||||||
element.className.split(' ').forEach(className => {
|
element.className.split(' ').forEach(className => {
|
||||||
if (/^umami--([a-z]+)--([\w]+[\w-]*)$/.test(className)) {
|
if (/^cappuccino--([a-z]+)--([\w]+[\w-]*)$/.test(className)) {
|
||||||
const [, type, value] = className.split('--');
|
const [, type, value] = className.split('--');
|
||||||
const listener = () => trackEvent(value, type);
|
const listener = () => trackEvent(value, type);
|
||||||
|
|
||||||
|
@ -155,14 +155,14 @@ import { removeTrailingSlash } from '../lib/url';
|
||||||
|
|
||||||
/* Global */
|
/* Global */
|
||||||
|
|
||||||
if (!window.umami) {
|
if (!window.cappuccino) {
|
||||||
const umami = event_value => trackEvent(event_value);
|
const cappuccino = event_value => trackEvent(event_value);
|
||||||
umami.trackView = trackView;
|
cappuccino.trackView = trackView;
|
||||||
umami.trackEvent = trackEvent;
|
cappuccino.trackEvent = trackEvent;
|
||||||
umami.addEvents = addEvents;
|
cappuccino.addEvents = addEvents;
|
||||||
umami.removeEvents = removeEvents;
|
cappuccino.removeEvents = removeEvents;
|
||||||
|
|
||||||
window.umami = umami;
|
window.cappuccino = cappuccino;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Start */
|
/* Start */
|
||||||
|
|
Loading…
Reference in New Issue