У меня проблема с добавлением в dayaLayer. Для gtm я использую этот плагин , но я не понимаю, как добавить для него dataLayer через компонент. Мой nuxt.config для плагина
modules: [
['@nuxtjs/google-tag-manager', {
id: 'GTM-xxxxxxxxxx',
pageViewEventName: 'nuxtRoute',
pageTracking: true,
layer: 'dataLayer'
}]
]
Мой компонент
head() {
return {
title: this.seo.title_meta,
meta: [
// hid is used as unique identifier. Do not use `vmid` for it as it will not work
{ hid: 'google-site-verification', name: 'google-site-verification', content: 'test' },
{ hid: 'description', name: 'description', content: this.seo.description_meta }
],
__dangerouslyDisableSanitizers: ['script'],
script: [
{
innerHTML: JSON.stringify({
'@context': 'http://schema.org',
'@type': 'Organization',
name: 'test',
url: 'https://test.co',
sameAs: this.linkMeta,
description: `${this.seo.description_meta}`
}),
type: 'application/ld+json'
},
{
innerHTML: `
window.dataLayer = window.dataLayer || [];
window.dataLayer = [{ 'pageType': 'Main'}]
`
}
]
};
},
Я попытался добавить скрипт с dataLayer в голову, но ничего не вышло. Мой плагин Google Tag Assistant не находит dataLayer. Спасибо за любую помощь!