mirror of
https://github.com/umami-software/umami.git
synced 2026-02-19 20:15:41 +01:00
initial setup. add crossdomain tracking.
This commit is contained in:
parent
0cb14f3f6c
commit
fa4130ebce
6 changed files with 196 additions and 2 deletions
31
tracker/shopify.js
Normal file
31
tracker/shopify.js
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
/* eslint-disable no-undef */
|
||||
const DOMAIN = 'http://localhost:3000';
|
||||
const TRACKER_SCRIPT_NAME = 'lemonsquare';
|
||||
const WEBSITE_ID = '21c0c2f5-ae71-47f2-a80a-05cc5052fec7';
|
||||
const AUTO_TRACK = 'false';
|
||||
const DO_NOT_TRACK = 'false';
|
||||
const CACHE = 'true';
|
||||
|
||||
const script = document.createElement('script');
|
||||
script.setAttribute('src', `${DOMAIN}/${TRACKER_SCRIPT_NAME}.js`);
|
||||
script.setAttribute('data-website-id', WEBSITE_ID);
|
||||
script.setAttribute('data-auto-track', AUTO_TRACK);
|
||||
script.setAttribute('data-do-not-track', DO_NOT_TRACK);
|
||||
script.setAttribute('data-cache', CACHE);
|
||||
script.setAttribute('async', '');
|
||||
script.setAttribute('defer', '');
|
||||
// initialize script
|
||||
document.head.appendChild(script);
|
||||
|
||||
analytics.subscribe('page_viewed', async event => {
|
||||
lemonsquare.trackView(event.url, event.referrer);
|
||||
});
|
||||
|
||||
// analytics.subscribe('product_viewed', async event => {
|
||||
// fbq('track', 'ViewContent', {
|
||||
// content_ids: [event.data.productVariant.id],
|
||||
// content_name: event.data.productVariant.title,
|
||||
// currency: event.data.productVariant.price.currencyCode,
|
||||
// value: event.data.productVariant.price.amount,
|
||||
// });
|
||||
// });
|
||||
Loading…
Add table
Add a link
Reference in a new issue