Skip to content

Commit 05608f9

Browse files
authored
Merge branch 'master' into niall/amplitude_group_call
2 parents 4c930b3 + e218ee0 commit 05608f9

File tree

9 files changed

+83
-37
lines changed

9 files changed

+83
-37
lines changed

src/connections/destinations/catalog/adobe-analytics/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ Device-mode web data is sent using Analytics.js, with Analytics.js either servin
6666

6767
Our Adobe Analytics device-mode destination code is open sourced on Github. Feel free to check it out:
6868
[iOS](https://github.com/segment-integrations/analytics-ios-integration-adobe-analytics),
69-
[Android](hhttps://github.com/segment-integrations/analytics-android-integration-adobe-analytics) and
69+
[Android](https://github.com/segment-integrations/analytics-android-integration-adobe-analytics) and
7070
[JS](https://github.com/segmentio/analytics.js-integrations/tree/master/integrations/adobe-analytics).
7171

7272
### Initialization

src/connections/destinations/catalog/algolia-insights/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ Algolia supports the following six events from Segment's [Ecommerce Spec](https:
7171
analytics.track('Product List Viewed', {
7272
products: [{
7373
objectID: "hit objectID",
74-
position: "hit position on index",
74+
position: hitPositionOnIndex, // number
7575
index: "my-index-name",
7676
queryID: "Algolia queryID" // required only for Click Analytics,
7777
}]
@@ -86,15 +86,15 @@ analytics.track('Product List Filtered', {
8686

8787
analytics.track('Product Viewed', {
8888
objectID: "hit objectID",
89-
position: "hit position on index",
89+
position: hitPositionOnIndex, // number
9090
index: "my-index-name",
9191
queryID: "Algolia queryID" // required only for Click Analytics,
9292
})
9393

9494

9595
analytics.track('Product Clicked', {
9696
objectID: "hit objectID",
97-
position: "hit position on index",
97+
position: hitPositionOnIndex, // number
9898
index: "my-index-name",
9999
queryID: "Algolia queryID" // required only for Click Analytics,
100100
})

src/connections/destinations/catalog/taplytics/index.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,21 @@ Once the Segment library is integrated with your app, add your API key and selec
1111
Follow the below steps for destination
1212

1313
### iOS
14-
To get started with Taplytics on iOS, first integrate your app with the Taplytics [iOS](/docs/connections/sources/catalog/libraries/mobile/ios) library. To get the API key, [login](https://taplytics.com/) to your account, select the App on the top left then click into the Settings menu on the left side. If you want to set up Push Notifications click on the Push Notification tab in their UI and [follow the instructions](https://taplytics.com/docs/guides/push-notifications/apple-push-certificates). Finally, you want to ensure you have configured your app delegate to [enable push notifications](/docs/connections/sources/catalog/libraries/mobile/ios/#how-do-i-use-push-notifications).
14+
To get started with Taplytics on iOS, first integrate your app with the Taplytics [iOS](/docs/connections/sources/catalog/libraries/mobile/ios) library. To get the API key, [login](https://taplytics.com/) to your account, select the App on the top left then click into the Settings menu on the left side. If you want to set up Push Notifications click on the Push Notification tab in their UI and [follow the instructions](https://docs.taplytics.com/docs/guides-push-notifications). Finally, you want to ensure you have configured your app delegate to [enable push notifications](/docs/connections/sources/catalog/libraries/mobile/ios/#how-do-i-use-push-notifications).
1515

16-
If you want to set up deep linking, just follow [this section of their docs](https://taplytics.com/docs/ios-sdk/getting-started#app-linking)!
16+
If you want to set up deep linking, just follow [this section of their docs](https://support.taplytics.com/hc/en-us/articles/360004176632-Deep-Linking-Guide-)!
1717

18-
For more information about setting up Taplytics on iOS, see their [docs](https://taplytics.com/docs/ios-sdk/getting-started)
18+
For more information about setting up Taplytics on iOS, see their [docs](https://docs.taplytics.com/docs/ios-getting-started)
1919

2020

2121
### Android
2222
To get up and running with Taplytics on Android, there a couple of steps we will walk you through. You first want to ensure that you've integrated your mobile app with our [Android](/docs/connections/sources/catalog/libraries/mobile/android) library.
2323

24-
To enable its full functionality (like Push Notifications, Deep linking), there are a couple of extra steps that you have to take care of in your Android app. [This document explains how to set up Push Notifications](https://taplytics.com/docs/android-sdk/push-notifications) and [ths one explains how to set up deep linking](https://taplytics.com/docs/android-sdk/getting-started#device-pairing).
24+
To enable its full functionality (like Push Notifications, Deep linking), there are a couple of extra steps that you have to take care of in your Android app. [This document explains how to set up Push Notifications](https://docs.taplytics.com/docs/guides-push-notifications) and [ths one explains how to set up deep linking](https://support.taplytics.com/hc/en-us/articles/360004176632-Deep-Linking-Guide-).
2525

2626

2727
## Identify
28-
Use [Identify](/docs/connections/sources/catalog/libraries/mobile/ios/#identify) to track user specific attributes. It equivalent to tracking [user attributes](https://taplytics.com/docs/guides/user-attributes-setup) on Taplytics. Taplytics supports traits supported by Segment as well as custom traits. If you set traits.id, we set that as the Unique ID for that user.
28+
Use [Identify](/docs/connections/sources/catalog/libraries/mobile/ios/#identify) to track user specific attributes. It equivalent to tracking [user attributes](https://docs.taplytics.com/docs/guides-user-insights) on Taplytics. Taplytics supports traits supported by Segment as well as custom traits. If you set traits.id, we set that as the Unique ID for that user.
2929

3030
## Track
3131
Use [track](/docs/connections/sources/catalog/libraries/mobile/ios/#track) to track events and user behaviour in your app.

src/connections/functions/destination-functions.md

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,12 @@ To change which type of event the handler listens to, you can rename it to the n
8686

8787
A function's execution is considered successful if it finishes without any errors. You can also `throw` an error to indicate a failure on purpose. You can use these errors to validate event data before processing it, to ensure your function works as expected.
8888

89-
There are three pre-defined error types that you can `throw` to indicate that the function ran as expected, but that data could not be delivered:
89+
You can `throw` the following pre-defined error types to indicate that the function ran as expected, but that data could not be delivered:
9090

9191
- `EventNotSupported`
9292
- `InvalidEventPayload`
9393
- `ValidationError`
94+
- `RetryError`
9495

9596
The examples show basic uses of these error types.
9697

@@ -110,6 +111,27 @@ async function onPage(event) {
110111
async function onAlias(event) {
111112
throw new EventNotSupported('Alias event is not supported')
112113
}
114+
115+
async function onTrack(event) {
116+
let res
117+
try {
118+
res = await fetch('http://example-service.com/api', {
119+
method: 'POST',
120+
headers: {
121+
'Content-Type': 'application/json'
122+
},
123+
body: JSON.stringify({ event })
124+
})
125+
} catch (err) {
126+
// Retry on connection error
127+
throw new RetryError(err.message)
128+
}
129+
if (res.status >= 500 || res.status === 429) {
130+
// Retry on 5xx and 429s (ratelimits)
131+
throw new RetryError(`HTTP Status ${res.status}`)
132+
}
133+
}
134+
113135
```
114136
If you do not supply a function for an event type, Segment throws an `EventNotSupported` error by default.
115137

@@ -186,8 +208,9 @@ A function can throw errors, or Segment might encounter errors while invoking yo
186208
- **Invalid Settings** - A configuration error prevented Segment from executing your code. If this error persists for more than an hour, [contact Segment Support](https://segment.com/help/contact/).
187209
- **Message Rejected** - Your code threw `InvalidEventPayload` or `ValidationError` due to invalid input.
188210
- **Unsupported Event Type** - Your code does not implement a specific event type (`onTrack()`, etc.) or threw a `EventNotSupported` error.
211+
- **Retry** - Your code threw `RetryError` indicating that the function should be retried.
189212

190-
When these errors occur, Segment does not attempt to send that event to your destination function again.
213+
Segment only attempts to send the event to your destination function again if a **Retry** error occurs.
191214

192215
### Destination functions logs
193216

src/connections/functions/source-functions.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,8 +350,9 @@ async function onRequest(request, settings) {
350350
- **Invalid Settings**: A configuration error prevented Segment from executing your code. If this error persists for more than an hour, [contact Segment Support](https://segment.com/help/contact/).
351351
- **Message Rejected**: Your code threw `InvalidEventPayload` or `ValidationError` due to invalid input.
352352
- **Unsupported Event Type**: Your code does not implement a specific event type (`onTrack()`, etc.) or threw a `EventNotSupported` error.
353+
- **Retry** - Your code threw `RetryError` indicating that the function should be retried.
353354

354-
These errors are not retried.
355+
Segment only attempts to run your source function again if a **Retry** error occurs.
355356

356357
## Managing source functions
357358

src/connections/sources/catalog/libraries/mobile/ios/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ configuration.trackPushNotifications = YES;
102102
```
103103

104104
### Automatic Deep Link Tracking
105-
Tracking deep linking will automatically track `Deep Link Clicked` and `Deep Link Opened`.
105+
Tracking deep linking will automatically track `Deep Link Opened`.
106106

107107
```objc
108108
SEGAnalyticsConfiguration *configuration = [SEGAnalyticsConfiguration configurationWithWriteKey:@"YOUR_WRITE_KEY"];

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ var DMW1 = function({ payload, integration, next }) {
5353
};
5454
```
5555

56+
> note ""
57+
> Currently only Device-mode Destinations are supported by Destination Middlewares
58+
5659
## Adding middlewares to Analytics.js
5760

5861
The above defined Source & Destination Middleware can be added to the Analytics.js execution chain as:

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,25 @@ console.log(JSON.stringify({ x: undefined, y: 6 }));
112112
// expected output: "{"y":6}"
113113
```
114114

115+
116+
### Can I overwrite the context fields?
117+
118+
Yes. This can be useful if some of these fields contain information you don't want to collect.
119+
120+
For example, imagine that your website allows users to view a receipt for purchases at the URL `https://mywebsite.com/store/purchases`. Your users click a link that redirects to that specific URL, your app sets a `receiptId` in the query string, and returns the appropriate receipt. You also send a Track call to Segment from this page.
121+
122+
Since this `receiptId` might contain sensitive information, you can prevent the context field `page.url` from being included in your Track call by overwriting the field in the `options` parameter, as in the example below:
123+
124+
```js
125+
analytics.track("Receipt Viewed", {}, {
126+
page: {
127+
url: null
128+
}
129+
})
130+
```
131+
132+
This works for any [context field](/docs/connections/spec/common/#context) that Segment automatically collects.
133+
115134
## Known Issues:
116135

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

0 commit comments

Comments
 (0)