Skip to content

Commit c978778

Browse files
authored
Merge pull request #4100 from segmentio/vanand17-patch-6
Impact of exposing the source write key - AJS
2 parents 266074c + 5ac9a91 commit c978778

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,17 @@ analytics.track("Receipt Viewed", {}, {
128128
}
129129
})
130130
```
131-
132131
This works for any [context field](/docs/connections/spec/common/#context) that Segment automatically collects.
133132

133+
134+
### What is the impact of exposing the source's write keys?
135+
136+
For the Segment script to work in the browser, you need to expose the write key in order for client-side tracking to work. Segment's library architecture requires the write key to be exposed, similar to that of other major tools like Google Analytics, Mixpanel, Kissmetrics, Hubspot, and Marketo.
137+
138+
If you see any unusual behavior associated with your write key, you can generate a new key. Navigate to **Connections > Sources** and select your source. On the **Settings** tab, go to the **API Keys** section, and click **Generate New Key**.
139+
140+
If you want to hide the write key, you can use Segment's [HTTP Tracking API source](/docs/connections/sources/catalog/libraries/server/http-api/) or one of the other [server-side libraries](/docs/connections/sources/catalog/#server).
141+
134142
### Can I add context fields that do not already exist?
135143

136144
Yes. Similar to overwriting context, you can add context fields by passing them into the options object as the third argument of the event call. For example, the analytics.js library does not automatically collect location information. To add this into the context object, pass it into the third argument as in the example below:
@@ -149,7 +157,6 @@ analytics.track("Order Completed", {}, {
149157
150158
Some destinations accept properties only. As a result, custom context fields you add may not forward to these destinations.
151159

152-
153160
## Known issues:
154161

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

0 commit comments

Comments
 (0)