You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The console reveals all. [Learn how to access the JavaScript console in each browser](#how-do-i-open-the-javascript-console-in-your-debugger).
7
-
Any Analytics.js methods may be executed manually. Use the Network tab to inspect requests.
6
+
To help you troubleshoot common issues when implementing Analytics.js, this page covers steps to verify your implementation, resolve errors, and ensure that data correctly flows to your destinations.
7
+
8
+
> info ""
9
+
> You can manually execute any Analytics.js methods. Use the **Network** tab to inspect requests. [Learn how to access the JavaScript console in each browser](#how-do-i-open-the-javascript-console-in-your-debugger).
8
10
9
11
## Are you loading Analytics.js?
10
12
11
-
Open the JavaScript console and enter `analytics`. Does it return an object, as seen below?
13
+
Open the JavaScript console and enter `analytics`. If it returns an object, as shown below, then you're successfully loading Analytics.js onto your website.
12
14
13
15

14
16
15
-
The object means that you are successfully loading Analytics.js onto your website. If you get an `undefined` error, Analytics.js is not loading successfully:
17
+
If you get an `undefined` error, Analytics.js is not loading successfully:
Segment also provides a Chrome web extension, [Segment Inspector](/docs/connections/sources/catalog/libraries/website/javascript/index.html#segment-inspector), which you can use to validate that you're successfully loading Analytics.js.
20
22
21
-
Solution: [Follow the Analytics.js Quickstart Guide](/docs/connections/sources/catalog/libraries/website/javascript/quickstart/)
23
+
To learn more, follow the [Analytics.js Quickstart Guide](/docs/connections/sources/catalog/libraries/website/javascript/quickstart/).
22
24
23
25
## Are you loading two instances of Analytics.js?
24
26
25
-
Note that you *cannot* load Analytics.js twice on the same page, even if you're using different write keys. You might encounter `Uncaught RangeError: Maximum call stack size exceeded`. You can conditionally set the write key based on an environment variable.
27
+
Note that you *cannot* load Analytics.js twice on the same page, even if you're using different write keys. If you do, you might encounter `Uncaught RangeError: Maximum call stack size exceeded`. Instead, you can conditionally set the write key based on an environment variable.
* Snippet syntax: Ensure you correctly added the Segment snippet to the page. Check for any missing or extra characters. Follow [this guide](/docs/connections/sources/catalog/libraries/website/javascript/quickstart/#step-2-install-segment-to-your-site).
39
+
- Snippet syntax: Ensure you correctly added the Segment snippet to the page. Check for any missing or extra characters. Follow [this guide](/docs/connections/sources/catalog/libraries/website/javascript/quickstart/#step-2-install-segment-to-your-site).
38
40
39
-
* NPM package: If you're using Segment through NPM, refer to [this guide](/docs/connections/sources/catalog/libraries/website/javascript/quickstart/#step-2b-install-segment-as-a-npm-package).
41
+
- npm package: If you're using Segment through npm, refer to [this guide](/docs/connections/sources/catalog/libraries/website/javascript/quickstart/#step-2b-install-segment-as-a-npm-package).
40
42
41
-
* Browser cache: Clear the browser cache, as this is a common cause for `ChunkLoadError`.
43
+
- Browser cache: Clear the browser cache, as this is a common cause for `ChunkLoadError`.
42
44
43
-
* Cloudflare caching: If you use Cloudflare to proxy Segment, disable caching for the Segment JS file.
45
+
- Cloudflare caching: If you use Cloudflare to proxy Segment, disable caching for the Segment JS file.
44
46
45
47
## Do you see events appear in your debugger?
46
48
47
-
When you reload the page, does your debugger show a new [`page`](/docs/connections/spec/page)? You can also check the JavaScript console in the browser and manually fire an event, like an Identify call, which would show up in the debugger.
49
+
When you reload the page, does your debugger show a new [Page call](/docs/connections/spec/page)? You can also check the JavaScript console in the browser and manually fire an event, like an Identify call, which would show up in the debugger.
48
50
49
-
- You can also use [Segment's Chrome extension](/docs/connections/sources/catalog/libraries/website/javascript/index.html#segment-inspector)to inspect events.
51
+
- You can use [Segment's Chrome extension](/docs/connections/sources/catalog/libraries/website/javascript/index.html#segment-inspector)to inspect events.
50
52
51
-

53
+

52
54
53
-
If the call doesn't appear in the debugger, open up the JavaScript console and check the Network tab to see if the outbound web services requests are being initiated:
55
+
If the call doesn't appear in the debugger, open the JavaScript console and check the **Network** tab to see if the outbound web services requests are being initiated:
54
56
55
57

56
58
57
-
In the above, the `p` is a [`page`](/docs/connections/spec/page) call and the `i` is an [`identify`](/docs/connections/spec/identify) call. If you don't at least see the `p`, then check if you are loading Analytics.js correctly.
59
+
In the above, the `p` is a [Page](/docs/connections/spec/page) call and the `i` is an [Identify](/docs/connections/spec/identify) call. If you don't at least see the `p`, verify that you are loading Analytics.js correctly.
58
60
59
61
## Using the Segment Chrome extension to validate your implementation
60
62
@@ -65,18 +67,18 @@ The [Segment Inspector](/docs/connections/sources/catalog/libraries/website/java
65
67
66
68
Some destinations send data directly from the website to their servers. You can check the Network tab in your JavaScript console to see the outbound web services requests being initiated.
67
69
68
-
In the image below, with Google Analytics as an example, the `page` call forms an outbound request that looks like this:
70
+
Using Google Analytics as an example, the Page call forms an outbound request that looks like this:
If this outbound request is not showing up in the network when you fire an `identify` call, then check the following:
74
+
If this outbound request is not showing up in the network when you fire an Identify call, then view the following sections for more troubleshooting steps.
73
75
74
76
75
-
## Is your web site deployed under a domain on the Public Suffix List?
77
+
## Is your website deployed under a domain on the Public Suffix List?
76
78
77
79
The [Public Suffix List](https://publicsuffix.org/list/){:target="blank"} is a catalog of certain Internet effective top-level domains, enumerating all domain suffixes controlled by registrars.
78
80
79
-
The implications of these domain suffixes is that first party cookies cannot be set on them. Meaning, `foo.example.co.uk` can share cookie access with `bar.example.co.uk`, but `example.co.uk` should be walled off from cookies at `example2.co.uk`. The latter two domains could be registered by different owners.
81
+
The implications of these domain suffixes are that first party cookies cannot be set on them. Meaning, `foo.example.co.uk` can share cookie access with `bar.example.co.uk`, but `example.co.uk` should be walled off from cookies at `example2.co.uk`. The latter two domains could be registered by different owners.
80
82
81
83
Examples of domains on the Public Suffix List that are common in troubleshooting include:
82
84
@@ -97,32 +99,32 @@ The JavaScript console reveals all requests, outbound and inbound, to your brows
97
99
Alternatively, Segment provides the [Segment Inspector](/docs/connections/sources/catalog/libraries/website/javascript/index.html#segment-inspector), a Chrome web extension designed to enable debugging of your Segment integration in web applications that are instrumented with Analytics.js.
98
100
99
101
100
-
## Analytics.js failing to load due to Ad Blockers or Browser Privacy Settings
102
+
## Analytics.js failing to load due to ad blockers or browser privacy settings
101
103
102
104
Segment advises against circumventing tracking blockers or browser privacy settings for client-side tracking. The user has ultimate control as to what gets loaded on the page. Segment acknowledges that this can result in some data loss in client-side tracking and suggests [workarounds](/docs/connections/sources/catalog/libraries/website/javascript/index.html#tracking-blockers-and-browser-privacy-settings) to address this issue.
103
105
104
-
## Analytics.js and Destinations not tracking query string parameters on certain Safari iOS and MacOS Versions
106
+
## Analytics.js and destinations not tracking query string parameters on certain Safari iOS and macOS versions
105
107
106
-
Due to updates in certain Safari iOS and MacOS versions, Segment's Analytics.js and Destinations tools might experience limitations in capturing query string parameters. As a result, you may notice some events missing campaign information.
108
+
Due to updates in certain Safari iOS and macOS versions, Segment's Analytics.js and destinations tools might experience limitations in capturing query string parameters. As a result, you may notice some events missing campaign information.
107
109
108
110
109
111
## Why am I seeing a "SameSite" warning?
110
112
111
113
If you see a warning like the following, it could have one of several causes:
112
114
"A cookie associated with a cross-site resource at http://segment.com/ was set without the `SameSite` attribute [...]"
113
115
114
-
Segment correctly sets cookies with the 'SameSite' attribute with Analytics.js.
116
+
Segment correctly sets cookies with the `SameSite` attribute with Analytics.js.
115
117
116
-
If you see this warning, it is because you previously visited http://segment.com, and are getting the warning due to unrelated cookies. To verify that this is the issue, visit your page in Incognito Mode and confirm that the warning no longer occurs. Your users won't see this warning unless they _also_ visited http://segment.com.
118
+
If you see this warning, it's because you previously visited http://segment.com, and are getting the warning due to unrelated cookies. To verify that this is the issue, visit your page in Incognito Mode and confirm that the warning no longer occurs. Your users won't see this warning unless they _also_ visited http://segment.com.
117
119
118
120
119
121
## Why am I seeing additional cookies on my website?
120
122
121
-
The AJS cookies being set under segment.com are first-party cookies. They are part of Segment's own implementation as well as the destination Segment uses. These cookies are not related to your implementation of Segment, and you only see them because you've visited Segment's domain using the same browser. They are sent to the writekey connected to Segment's own workspace, and are associated with the events Segment tracks when you visit segment.com.
123
+
The Analytics.js cookies being set under segment.com are first-party cookies. They are part of Segment's own implementation as well as the destination Segment uses. These cookies are not related to your implementation of Segment, and you only see them because you've visited Segment's domain using the same browser. They are sent to the writekey connected to Segment's own workspace, and are associated with the events Segment tracks when you visit segment.com.
122
124
123
-
### Known Incompatibilities with Prototype.js
125
+
### Known incompatibilities with Prototype.js
124
126
125
-
If you're having issues with your destinations loading with Prototype.js, there is a [known issue that was reported](https://github.com/prototypejs/prototype/issues/338){:target="_blank"} regarding this. In order to prevent the issues, you can preserve the original `Array.from` method without letting the prototype override it.
127
+
If you're having issues with your destinations loading with Prototype.js, there is a [known issue that was reported](https://github.com/prototypejs/prototype/issues/338){:target="_blank"} regarding this. In order to prevent the issue, you can preserve the original `Array.from` method without letting the prototype override it.
126
128
127
129
128
130
## Why am I getting an empty campaign object in my event payload?
@@ -133,6 +135,8 @@ Analytics.js generates a campaign object inside the context object whenever the
133
135
134
136
You may see events with timestamp discrepancies due to manual overriding of the timestamp value, mobile apps closed or set in the background, traffic from bots, or inaccurate device or browser time. For more information, see Segment's [Common Fields Spec](/docs/connections/spec/common/#why-are-events-received-with-timestamps-set-in-the-past-or-future).
135
137
136
-
## Known issues:
138
+
## View additional known issues
139
+
140
+
You can review other known issues in [GitHub](https://github.com/segmentio/analytics.js/issues).
141
+
137
142
138
-
[Review and contribute to these on GitHub](https://github.com/segmentio/analytics.js/issues).
0 commit comments