Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Добавлена метрика #18

Merged
merged 8 commits into from
Sep 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@
<div>
<SiteHeader/>
<div>
<NuxtPage/>
<NuxtPage/>
</div>
<YandexMetrika/>
</div>
</template>
<script>
import SiteBar from "./components/SiteBar";
import SiteFooter from "./components/SiteFooter";

export default {
components: { SiteFooter, SiteBar }
components: {}
}
</script>
41 changes: 41 additions & 0 deletions components/YandexMetrika.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<template>
<div>
<!-- Yandex.Metrika counter -->
<img src="https://mc.yandex.ru/watch/90252793" style="position:absolute; left:-9999px;" alt=""/>
<!-- /Yandex.Metrika counter -->
</div>
</template>

<script>
if (process.client) {
(function (m, e, t, r, i, k, a) {
m[i] = m[i] || function () {
(m[i].a = m[i].a || []).push(arguments)
};
var z = null;
m[i].l = 1 * new Date();
for (var j = 0; j < document.scripts.length; j++) {
if (document.scripts[j].src === r) {
return;
}
}
k = e.createElement(t), a = e.getElementsByTagName(t)[0], k.async = 1, k.src = r, a.parentNode.insertBefore(k, a)
})
(window, document, "script", "https://mc.yandex.ru/metrika/tag.js", "ym");

ym(90252793, "init", {
clickmap: true,
trackLinks: true,
accurateTrackBounce: true,
webvisor: true
});
}

export default {
name: "YandexMetrika",
}
</script>

<style scoped>

</style>
12 changes: 2 additions & 10 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-ignore
import { defineNuxtConfig } from 'nuxt'

// https://v3.nuxtjs.org/api/configuration/nuxt.config
Expand All @@ -7,7 +8,7 @@ export default defineNuxtConfig({
// Generate images to `/_nuxt/image/file.png`
staticFilename: '[publicPath]/images/[name]-[hash][ext]',
},
modules: ['@nuxt/content', '@nuxtjs/tailwindcss', '@nuxt/image-edge', '@nuxtjs/yandex-metrika'],
modules: ['@nuxt/content', '@nuxtjs/tailwindcss', '@nuxt/image-edge',],
content: {
navigation: {
fields: ['icon']
Expand All @@ -27,13 +28,4 @@ export default defineNuxtConfig({
tailwindcss: {
cssPath: '~/assets/css/main.css',
},
publicRuntimeConfig: {
yandexMetrika: {
id: 90252793,
clickmap: true,
trackLinks: true,
accurateTrackBounce: true,
webvisor: true
}
}
})
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@
"devDependencies": {
"@heroicons/vue": "^2.0.10",
"@nuxt/content": "^2.0.1",
"@nuxt/image-edge": "^1.0.0-27707824.1028381",
"@nuxt/image-edge": "=1.0.0-27657146.da85542",
"@nuxtjs/tailwindcss": "^5.3.2",
"@nuxtjs/yandex-metrika": "^1.4.0",
"@tailwindcss/typography": "^0.5.7",
"nuxt": "^3.0.0-rc.9",
"shiki-es": "^0.1.2"
Expand Down
Loading