Support Wide Angle Analytics values.
This commit is contained in:
parent
7b78980023
commit
804e8ea1d8
6 changed files with 5593 additions and 6631 deletions
|
@ -86,9 +86,9 @@ export default defineNuxtConfig({
|
||||||
The Wide Angle Analytics provides an instance of `waa` which can be then injected to your component.
|
The Wide Angle Analytics provides an instance of `waa` which can be then injected to your component.
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
import { useWideAngle } from '#imports'
|
import { useWideAngle } from '#imports';
|
||||||
|
|
||||||
useWideAngle('purchase', {'basket_value': '45.00'})
|
useWideAngle('purchase', {'basket_element': 'dress'}, {'basket_item_price': 123.44});
|
||||||
```
|
```
|
||||||
|
|
||||||
You will find a fully functional example in this [repository](playground/app.vue).
|
You will find a fully functional example in this [repository](playground/app.vue).
|
||||||
|
|
12200
package-lock.json
generated
12200
package-lock.json
generated
File diff suppressed because it is too large
Load diff
10
package.json
10
package.json
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "wideangle-nuxt",
|
"name": "wideangle-nuxt",
|
||||||
"version": "1.1.0",
|
"version": "1.2.0",
|
||||||
"description": "Wide Angle Analytics module for Nuxt",
|
"description": "Wide Angle Analytics module for Nuxt",
|
||||||
"repository": "inputobjects/wideangle-nuxt",
|
"repository": "inputobjects/wideangle-nuxt",
|
||||||
"author": "Wide Angle Analytics <developers@wideangle.co>",
|
"author": "Wide Angle Analytics <developers@wideangle.co>",
|
||||||
|
@ -38,19 +38,19 @@
|
||||||
"test:watch": "vitest watch"
|
"test:watch": "vitest watch"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@nuxt/kit": "^3.11.1",
|
"@nuxt/kit": "^3.13.2",
|
||||||
"wideangle-vuejs": "1.0.0",
|
"wideangle-vuejs": "1.0.0",
|
||||||
"defu": "^6.1.2"
|
"defu": "^6.1.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@nuxt/eslint-config": "^0.2.0",
|
"@nuxt/eslint-config": "^0.2.0",
|
||||||
"@nuxt/module-builder": "^0.5.5",
|
"@nuxt/module-builder": "^0.8.4",
|
||||||
"@nuxt/schema": "^3.11.1",
|
"@nuxt/schema": "^3.13.2",
|
||||||
"@nuxt/test-utils": "^3.12.0",
|
"@nuxt/test-utils": "^3.12.0",
|
||||||
"@types/node": "^18",
|
"@types/node": "^18",
|
||||||
"changelogen": "^0.5.3",
|
"changelogen": "^0.5.3",
|
||||||
"eslint": "^8.39.0",
|
"eslint": "^8.39.0",
|
||||||
"nuxt": "^3.11.1",
|
"nuxt": "^3.13.2",
|
||||||
"vitest": "^1.4.0"
|
"vitest": "^1.4.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
import { useWaaEvent } from "#imports";
|
import { useWaaEvent } from "#imports";
|
||||||
|
|
||||||
function trackClick() {
|
function trackClick() {
|
||||||
useWaaEvent("foo", {"name": "bar"});
|
useWaaEvent("foo", {"name": "bar"}, {"count" : 2});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,7 @@ export default defineNuxtConfig({
|
||||||
runtimeConfig: {
|
runtimeConfig: {
|
||||||
public: {
|
public: {
|
||||||
wideangle: {
|
wideangle: {
|
||||||
siteId: "8D27G3B9ACA01F4241",
|
siteId: "7982G3B9ACB1BF4380",
|
||||||
domain: "wideangle.local:3000",
|
|
||||||
fingerprint: true,
|
fingerprint: true,
|
||||||
supressDnt: true
|
supressDnt: true
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
import { useNuxtApp } from '#imports';
|
import { useNuxtApp } from '#imports';
|
||||||
|
|
||||||
export function useWaaEvent (name: string, params?: Record<string, any>) {
|
export function useWaaEvent (name: string, params?: Record<string, any>, values?: Record<string, number>) {
|
||||||
const waa = useNuxtApp().$waa
|
const waa = useNuxtApp().$waa
|
||||||
|
console.debug(`[WAA] Attempting to send Wide Angle event: ${name}`);
|
||||||
if(waa && waa.value) {
|
if(waa && waa.value) {
|
||||||
waa.value.dispatchEvent(name, params);
|
waa.value.dispatchEvent(name, params, values);
|
||||||
} else {
|
} else {
|
||||||
console.debug("[WAA] Wide Angle Analytics is not yest initialized");
|
console.debug("[WAA] Wide Angle Analytics is not yest initialized");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue