Skip to content

Commit 5fedad7

Browse files
committed
Troubleshooting cleanup
1 parent c27127d commit 5fedad7

File tree

1 file changed

+33
-29
lines changed

1 file changed

+33
-29
lines changed

src/connections/sources/catalog/libraries/website/javascript/troubleshooting.md

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,28 @@ title: Troubleshooting Analytics.js
33
strat: ajs
44
---
55

6-
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).
810
911
## Are you loading Analytics.js?
1012

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.
1214

1315
![Returning analytics object](images/VOsmoAB.gif)
1416

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:
1618

1719
![Returning analytics object error](images/CFsktto.gif)
1820

1921
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.
2022

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/).
2224

2325
## Are you loading two instances of Analytics.js?
2426

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.
2628

2729
Example:
2830
```js
@@ -34,27 +36,27 @@ ENV === 'production' ? writeKey = 'A' : writeKey = 'B';
3436

3537
The error can occur for different reasons:
3638

37-
* 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).
3840

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).
4042

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`.
4244

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.
4446

4547
## Do you see events appear in your debugger?
4648

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.
4850

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.
5052

51-
![Making an identify call](images/7Ymnh2S.gif)
53+
![Making an Identify call](images/7Ymnh2S.gif)
5254

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:
5456

5557
![Checking for calls in the network tab](images/d8CmIY2.png)
5658

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.
5860

5961
## Using the Segment Chrome extension to validate your implementation
6062

@@ -65,18 +67,18 @@ The [Segment Inspector](/docs/connections/sources/catalog/libraries/website/java
6567

6668
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.
6769

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:
6971

7072
![Google Analytics outbound request](images/CBdS5dO.png)
7173

72-
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.
7375

7476

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?
7678

7779
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.
7880

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.
8082

8183
Examples of domains on the Public Suffix List that are common in troubleshooting include:
8284

@@ -97,32 +99,32 @@ The JavaScript console reveals all requests, outbound and inbound, to your brows
9799
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.
98100

99101

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
101103

102104
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.
103105

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
105107

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.
107109

108110

109111
## Why am I seeing a "SameSite" warning?
110112

111113
If you see a warning like the following, it could have one of several causes:
112114
"A cookie associated with a cross-site resource at http://segment.com/ was set without the `SameSite` attribute [...]"
113115

114-
Segment correctly sets cookies with the 'SameSite' attribute with Analytics.js.
116+
Segment correctly sets cookies with the `SameSite` attribute with Analytics.js.
115117

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.
117119

118120

119121
## Why am I seeing additional cookies on my website?
120122

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.
122124

123-
### Known Incompatibilities with Prototype.js
125+
### Known incompatibilities with Prototype.js
124126

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.
126128

127129

128130
## 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
133135

134136
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).
135137

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+
137142

138-
[Review and contribute to these on GitHub](https://github.com/segmentio/analytics.js/issues).

0 commit comments

Comments
 (0)