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