Inyectar red de espionaje masivo
Some checks failed
continuous-integration/drone the build failed

This commit is contained in:
Nulo 2021-07-08 14:15:39 +00:00
parent eef0c87a79
commit d898082e88
4 changed files with 39 additions and 0 deletions

View file

@ -22,3 +22,10 @@ pnpm run format
``` ```
pnpm run build pnpm run build
``` ```
### Google Tag Manager
Para compilar con Google Tag Manager, usá la variable `TRACKEAR_A_LXS_USUARIXS`:
```
TRACKEAR_A_LXS_USUARIXS=ID_DE_TAG_MANAGER pnpm run build
```

View file

@ -11,6 +11,7 @@
}, },
"devDependencies": { "devDependencies": {
"@types/howler": "^2.2.3", "@types/howler": "^2.2.3",
"@types/node": "^16.0.1",
"@vitejs/plugin-legacy": "^1.4.3", "@vitejs/plugin-legacy": "^1.4.3",
"prettier": "2.3.2", "prettier": "2.3.2",
"typescript": "^4.3.5", "typescript": "^4.3.5",

View file

@ -2,6 +2,7 @@ lockfileVersion: 5.3
specifiers: specifiers:
'@types/howler': ^2.2.3 '@types/howler': ^2.2.3
'@types/node': ^16.0.1
'@vitejs/plugin-legacy': ^1.4.3 '@vitejs/plugin-legacy': ^1.4.3
howler: ^2.2.3 howler: ^2.2.3
prettier: 2.3.2 prettier: 2.3.2
@ -13,6 +14,7 @@ dependencies:
devDependencies: devDependencies:
'@types/howler': 2.2.3 '@types/howler': 2.2.3
'@types/node': 16.0.1
'@vitejs/plugin-legacy': 1.4.3_vite@2.4.1 '@vitejs/plugin-legacy': 1.4.3_vite@2.4.1
prettier: 2.3.2 prettier: 2.3.2
typescript: 4.3.5 typescript: 4.3.5
@ -29,6 +31,10 @@ packages:
resolution: {integrity: sha512-rzIE56NmGh7t8LdZT/zuBMa9iZvwqVmB65gNhwNLtrGEIHdWkEDp1fVmoM/zctR4UJZFe0uP01AmPuPzOwhecA==} resolution: {integrity: sha512-rzIE56NmGh7t8LdZT/zuBMa9iZvwqVmB65gNhwNLtrGEIHdWkEDp1fVmoM/zctR4UJZFe0uP01AmPuPzOwhecA==}
dev: true dev: true
/@types/node/16.0.1:
resolution: {integrity: sha512-hBOx4SUlEPKwRi6PrXuTGw1z6lz0fjsibcWCM378YxsSu/6+C30L6CR49zIBKHiwNWCYIcOLjg4OHKZaFeLAug==}
dev: true
/@vitejs/plugin-legacy/1.4.3_vite@2.4.1: /@vitejs/plugin-legacy/1.4.3_vite@2.4.1:
resolution: {integrity: sha512-lxZUJaMWYMQuqvZM1wPzDP6KABQgA/drVL5fnaygEPcz9adc2OHhfFNN/SvvHQ1V0rP8gybIc7uA+iI1gAdkVQ==} resolution: {integrity: sha512-lxZUJaMWYMQuqvZM1wPzDP6KABQgA/drVL5fnaygEPcz9adc2OHhfFNN/SvvHQ1V0rP8gybIc7uA+iI1gAdkVQ==}
engines: {node: '>=12.0.0'} engines: {node: '>=12.0.0'}

View file

@ -5,5 +5,30 @@ export default {
legacy({ legacy({
targets: ["defaults", "not IE 11"], targets: ["defaults", "not IE 11"],
}), }),
{
name: "google-tag-manager",
transformIndexHtml() {
if (process.env.TRACKEAR_A_LXS_USUARIXS) {
const id = process.env.TRACKEAR_A_LXS_USUARIXS;
return [
{
tag: "script",
attrs: {
src: "https://www.googletagmanager.com/gtag/js?id=" + id,
async: true,
},
},
{
tag: "script",
children: `
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '${id}');`,
},
];
} else return [];
},
},
], ],
}; };