You've already forked AstralRinth
forked from didirus/AstralRinth
Remove analytics (#197)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
export const DEFAULT_OPTIONS = {
|
||||
enabled: false,
|
||||
script_url: 'https://example.com',
|
||||
tracking_code: 'xxx',
|
||||
script_url: 'https://static.cloudflareinsights.com/beacon.min.js',
|
||||
token: 'xxx',
|
||||
}
|
||||
export const UNAMI_LIB_TAG_ID = 'unami-import'
|
||||
export const CF_LIB_TAG_ID = 'cf-import'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { DEFAULT_OPTIONS, UNAMI_LIB_TAG_ID } from './constants'
|
||||
import { DEFAULT_OPTIONS, CF_LIB_TAG_ID } from './constants'
|
||||
|
||||
const { resolve } = require('path')
|
||||
|
||||
@@ -12,7 +12,7 @@ module.exports = async function module(moduleOptions) {
|
||||
|
||||
const templatesOptions = {
|
||||
...options,
|
||||
UNAMI_LIB_TAG_ID,
|
||||
CF_LIB_TAG_ID,
|
||||
}
|
||||
|
||||
this.addPlugin({
|
||||
|
||||
@@ -3,7 +3,7 @@ export default async function (ctx, inject) {
|
||||
const config = (ctx.$config && ctx.$config.analytics) || {}
|
||||
|
||||
const url = config.script_url ?? '<%= options.script_url %>'
|
||||
const tag = config.tracking_code ?? '<%= options.tracking_code %>'
|
||||
const tag = config.token ?? '<%= options.token %>'
|
||||
// eslint-disable-next-line
|
||||
const enabled = config.enabled ?? ('<%= options.enabled || false %>' === 'true');
|
||||
// Check if the parameters are not changed by runtime config:
|
||||
@@ -27,8 +27,10 @@ export default async function (ctx, inject) {
|
||||
const analyticsScript = {
|
||||
hid: UNAMI_LIB_TAG_ID,
|
||||
src: url,
|
||||
'data-website-id': tag,
|
||||
async: true,
|
||||
'data-cf-beacon': JSON.stringify({
|
||||
token: tag,
|
||||
spa: true,
|
||||
}),
|
||||
defer: true,
|
||||
}
|
||||
injectScript(analyticsScript)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@modrinth/analytics",
|
||||
"version": "0.1.0",
|
||||
"description": "Unami integration for Nuxtjs",
|
||||
"description": "Cloudflare analytics integration for Nuxtjs",
|
||||
"license": "MIT",
|
||||
"contributors": [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user