Support Wide Angle Analytics values.

This commit is contained in:
Jarek Rozanski 2024-09-22 19:58:12 +00:00
parent 7b78980023
commit 804e8ea1d8
6 changed files with 5593 additions and 6631 deletions

View file

@ -86,9 +86,9 @@ export default defineNuxtConfig({
The Wide Angle Analytics provides an instance of `waa` which can be then injected to your component.
```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).

12200
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
{
"name": "wideangle-nuxt",
"version": "1.1.0",
"version": "1.2.0",
"description": "Wide Angle Analytics module for Nuxt",
"repository": "inputobjects/wideangle-nuxt",
"author": "Wide Angle Analytics <developers@wideangle.co>",
@ -38,19 +38,19 @@
"test:watch": "vitest watch"
},
"dependencies": {
"@nuxt/kit": "^3.11.1",
"@nuxt/kit": "^3.13.2",
"wideangle-vuejs": "1.0.0",
"defu": "^6.1.2"
},
"devDependencies": {
"@nuxt/eslint-config": "^0.2.0",
"@nuxt/module-builder": "^0.5.5",
"@nuxt/schema": "^3.11.1",
"@nuxt/module-builder": "^0.8.4",
"@nuxt/schema": "^3.13.2",
"@nuxt/test-utils": "^3.12.0",
"@types/node": "^18",
"changelogen": "^0.5.3",
"eslint": "^8.39.0",
"nuxt": "^3.11.1",
"nuxt": "^3.13.2",
"vitest": "^1.4.0"
}
}

View file

@ -11,7 +11,7 @@
import { useWaaEvent } from "#imports";
function trackClick() {
useWaaEvent("foo", {"name": "bar"});
useWaaEvent("foo", {"name": "bar"}, {"count" : 2});
}
</script>

View file

@ -3,8 +3,7 @@ export default defineNuxtConfig({
runtimeConfig: {
public: {
wideangle: {
siteId: "8D27G3B9ACA01F4241",
domain: "wideangle.local:3000",
siteId: "7982G3B9ACB1BF4380",
fingerprint: true,
supressDnt: true
}

View file

@ -1,9 +1,10 @@
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
console.debug(`[WAA] Attempting to send Wide Angle event: ${name}`);
if(waa && waa.value) {
waa.value.dispatchEvent(name, params);
waa.value.dispatchEvent(name, params, values);
} else {
console.debug("[WAA] Wide Angle Analytics is not yest initialized");
}