@arthurreira/analytics 0.6.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.js +3 -2
- package/dist/index.js +3 -2
- package/package.json +1 -1
package/dist/client.js
CHANGED
|
@@ -54,7 +54,7 @@ async function createSession(apiUrl, apiKey, visitorId) {
|
|
|
54
54
|
const response = await fetch(`${apiUrl}/sessions`, {
|
|
55
55
|
method: "POST",
|
|
56
56
|
headers: {
|
|
57
|
-
"
|
|
57
|
+
"X-API-Key": apiKey,
|
|
58
58
|
"Content-Type": "application/json"
|
|
59
59
|
},
|
|
60
60
|
body: JSON.stringify(sessionData)
|
|
@@ -66,7 +66,7 @@ async function sendEvent(apiUrl, apiKey, payload) {
|
|
|
66
66
|
await fetch(`${apiUrl}/events`, {
|
|
67
67
|
method: "POST",
|
|
68
68
|
headers: {
|
|
69
|
-
"
|
|
69
|
+
"X-API-Key": apiKey,
|
|
70
70
|
"Content-Type": "application/json"
|
|
71
71
|
},
|
|
72
72
|
body: JSON.stringify(payload)
|
|
@@ -76,6 +76,7 @@ async function trackPageview(apiUrl, apiKey, sessionId, path) {
|
|
|
76
76
|
await sendEvent(apiUrl, apiKey, {
|
|
77
77
|
...BASE_FIELDS(sessionId, "pageview", path),
|
|
78
78
|
page_url: `${typeof window !== "undefined" ? window.location.origin : ""}${path}`,
|
|
79
|
+
page_title: typeof document !== "undefined" ? document.title || null : null,
|
|
79
80
|
referrer: typeof document !== "undefined" ? document.referrer || null : null,
|
|
80
81
|
scroll_depth: 0
|
|
81
82
|
});
|
package/dist/index.js
CHANGED
|
@@ -45,7 +45,7 @@ async function createSession(apiUrl, apiKey, visitorId) {
|
|
|
45
45
|
const response = await fetch(`${apiUrl}/sessions`, {
|
|
46
46
|
method: "POST",
|
|
47
47
|
headers: {
|
|
48
|
-
"
|
|
48
|
+
"X-API-Key": apiKey,
|
|
49
49
|
"Content-Type": "application/json"
|
|
50
50
|
},
|
|
51
51
|
body: JSON.stringify(sessionData)
|
|
@@ -57,7 +57,7 @@ async function sendEvent(apiUrl, apiKey, payload) {
|
|
|
57
57
|
await fetch(`${apiUrl}/events`, {
|
|
58
58
|
method: "POST",
|
|
59
59
|
headers: {
|
|
60
|
-
"
|
|
60
|
+
"X-API-Key": apiKey,
|
|
61
61
|
"Content-Type": "application/json"
|
|
62
62
|
},
|
|
63
63
|
body: JSON.stringify(payload)
|
|
@@ -67,6 +67,7 @@ async function trackPageview(apiUrl, apiKey, sessionId, path) {
|
|
|
67
67
|
await sendEvent(apiUrl, apiKey, {
|
|
68
68
|
...BASE_FIELDS(sessionId, "pageview", path),
|
|
69
69
|
page_url: `${typeof window !== "undefined" ? window.location.origin : ""}${path}`,
|
|
70
|
+
page_title: typeof document !== "undefined" ? document.title || null : null,
|
|
70
71
|
referrer: typeof document !== "undefined" ? document.referrer || null : null,
|
|
71
72
|
scroll_depth: 0
|
|
72
73
|
});
|
package/package.json
CHANGED