nuxt-yandex-metrika 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/module.json +1 -1
- package/dist/module.mjs +1 -1
- package/dist/runtime/components/yandex-metrika-informer.vue +2 -5
- package/dist/runtime/components/yandex-verification.vue +4 -12
- package/dist/runtime/composables/useYandexMetrika.d.ts +1 -1
- package/dist/runtime/plugin.mjs +3 -17
- package/dist/runtime/yandex-metrika/YandexMetrika.d.ts +4 -4
- package/dist/runtime/yandex-metrika/YandexMetrika.mjs +2 -7
- package/dist/runtime/yandex-metrika/index.d.ts +2 -2
- package/package.json +1 -1
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { useYandexMetrika } from
|
|
2
|
+
import { useYandexMetrika } from '../composables/useYandexMetrika';
|
|
3
3
|
const { id } = useYandexMetrika();
|
|
4
4
|
</script>
|
|
5
5
|
|
|
6
6
|
<template>
|
|
7
7
|
<!-- Yandex.Metrika informer -->
|
|
8
|
-
<a
|
|
9
|
-
:href="`https://metrika.yandex.ru/stat/?id=${id}&from=informer`"
|
|
10
|
-
target="_blank"
|
|
11
|
-
rel="nofollow"
|
|
8
|
+
<a :href="`https://metrika.yandex.ru/stat/?id=${id}&from=informer`" target="_blank" rel="nofollow"
|
|
12
9
|
><img
|
|
13
10
|
:src="`https://informer.yandex.ru/informer/${id}/3_1_FFFFFFFF_EFEFEFFF_0_pageviews`"
|
|
14
11
|
style="width: 88px; height: 31px; border: 0"
|
|
@@ -1,24 +1,16 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { useYandexMetrika } from
|
|
3
|
-
import chalk from
|
|
2
|
+
import { useYandexMetrika } from '../composables/useYandexMetrika';
|
|
3
|
+
import chalk from 'chalk';
|
|
4
4
|
|
|
5
5
|
const { verification } = useYandexMetrika();
|
|
6
6
|
|
|
7
7
|
if (!verification) {
|
|
8
|
-
console.error(
|
|
9
|
-
`${chalk.bgRed(chalk.black("[yandex-metrika]"))} ${chalk.red(
|
|
10
|
-
"Verification key not found",
|
|
11
|
-
)}`,
|
|
12
|
-
);
|
|
8
|
+
console.error(`${chalk.bgRed(chalk.black('[yandex-metrika]'))} ${chalk.red('Verification key not found')}`);
|
|
13
9
|
}
|
|
14
10
|
</script>
|
|
15
11
|
|
|
16
12
|
<template>
|
|
17
|
-
<Meta
|
|
18
|
-
v-if="verification"
|
|
19
|
-
name="yandex-verification"
|
|
20
|
-
:content="verification"
|
|
21
|
-
/>
|
|
13
|
+
<Meta v-if="verification" name="yandex-verification" :content="verification" />
|
|
22
14
|
</template>
|
|
23
15
|
|
|
24
16
|
<style scoped></style>
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { YandexMetrika } from
|
|
1
|
+
import { YandexMetrika } from '../yandex-metrika';
|
|
2
2
|
export declare function useYandexMetrika(): YandexMetrika;
|
package/dist/runtime/plugin.mjs
CHANGED
|
@@ -1,22 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
defineNuxtPlugin,
|
|
3
|
-
useHead,
|
|
4
|
-
useRouter,
|
|
5
|
-
useRuntimeConfig
|
|
6
|
-
} from "#imports";
|
|
1
|
+
import { defineNuxtPlugin, useHead, useRouter, useRuntimeConfig } from "#imports";
|
|
7
2
|
import { Methods, YandexMetrika } from "./yandex-metrika/index.mjs";
|
|
8
3
|
export default defineNuxtPlugin({
|
|
9
4
|
parallel: true,
|
|
10
5
|
setup() {
|
|
11
6
|
const config = useRuntimeConfig().public.yandexMetrika;
|
|
12
|
-
const {
|
|
13
|
-
id,
|
|
14
|
-
cdn = false,
|
|
15
|
-
delay = 0,
|
|
16
|
-
debug,
|
|
17
|
-
verification = null,
|
|
18
|
-
options = {}
|
|
19
|
-
} = config;
|
|
7
|
+
const { id, cdn = false, delay = 0, debug, verification = null, options = {} } = config;
|
|
20
8
|
if (!debug) {
|
|
21
9
|
useHead({
|
|
22
10
|
noscript: [
|
|
@@ -33,9 +21,7 @@ export default defineNuxtPlugin({
|
|
|
33
21
|
innerHTML: `window.ym=window.ym||function(){(window.ym.a=window.ym.a||[]).push(arguments)};window.ym.l=(new Date).getTime();`
|
|
34
22
|
},
|
|
35
23
|
{
|
|
36
|
-
innerHTML: `ym("${id}","${Methods.Init}", ${JSON.stringify(
|
|
37
|
-
options
|
|
38
|
-
)});`
|
|
24
|
+
innerHTML: `ym("${id}","${Methods.Init}", ${JSON.stringify(options)});`
|
|
39
25
|
}
|
|
40
26
|
]
|
|
41
27
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Events, HitOptions, InitParameters, People, UserParameters, VisitParameters } from
|
|
2
|
-
export * from
|
|
1
|
+
import { Events, HitOptions, InitParameters, People, UserParameters, VisitParameters } from './types';
|
|
2
|
+
export * from './types';
|
|
3
3
|
export declare class YandexMetrika implements Events {
|
|
4
4
|
#private;
|
|
5
5
|
static src(cdn?: boolean): "https://cdn.jsdelivr.net/npm/yandex-metrica-watch/tag.js" | "https://mc.yandex.ru/metrika/tag.js";
|
|
@@ -11,13 +11,13 @@ export declare class YandexMetrika implements Events {
|
|
|
11
11
|
get id(): string;
|
|
12
12
|
init(options?: InitParameters): void;
|
|
13
13
|
addFileExtension(extensions?: string | string[]): void;
|
|
14
|
-
extLink<CTX>(url: string, options?: Omit<HitOptions<CTX>,
|
|
14
|
+
extLink<CTX>(url: string, options?: Omit<HitOptions<CTX>, 'referer'>): void;
|
|
15
15
|
file<CTX>(url: string, options?: HitOptions<CTX>): void;
|
|
16
16
|
firstPartyParams(people: People): void;
|
|
17
17
|
firstPartyParamsHashed(people: People): void;
|
|
18
18
|
getClientID(cb: (clientID: number) => void): void;
|
|
19
19
|
hit<CTX>(url?: string, options?: HitOptions<CTX>): void;
|
|
20
|
-
notBounce<CTX>(options?: Pick<HitOptions<CTX>,
|
|
20
|
+
notBounce<CTX>(options?: Pick<HitOptions<CTX>, 'ctx' | 'callback'>): void;
|
|
21
21
|
params(params?: VisitParameters): void;
|
|
22
22
|
reachGoal<CTX>(target: string, params: VisitParameters, callback?: (this: CTX) => void, ctx?: CTX): void;
|
|
23
23
|
setUserID(userId: string): void;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import chalk from "chalk";
|
|
2
|
-
import {
|
|
3
|
-
Methods
|
|
4
|
-
} from "./types.mjs";
|
|
2
|
+
import { Methods } from "./types.mjs";
|
|
5
3
|
export * from "./types.mjs";
|
|
6
4
|
export class YandexMetrika {
|
|
7
5
|
#id;
|
|
@@ -69,10 +67,7 @@ export class YandexMetrika {
|
|
|
69
67
|
}
|
|
70
68
|
#call(type, ...args) {
|
|
71
69
|
if (this.#debug) {
|
|
72
|
-
console.debug(
|
|
73
|
-
`${chalk.bgGreen(chalk.black("[yandex-metrika]"))} ${chalk.blue(type)}`,
|
|
74
|
-
...args
|
|
75
|
-
);
|
|
70
|
+
console.debug(`${chalk.bgGreen(chalk.black("[yandex-metrika]"))} ${chalk.blue(type)}`, ...args);
|
|
76
71
|
}
|
|
77
72
|
if (typeof window !== "undefined") {
|
|
78
73
|
window.ym(this.id, type, ...args);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { YandexMetrika } from
|
|
2
|
-
export * from
|
|
1
|
+
export { YandexMetrika } from './YandexMetrika';
|
|
2
|
+
export * from './types';
|