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
## 💸 TL;DR
<!-- What's the three sentence summary of purpose of the PR -->
Improve code block formatting and syntax highlighting. Does not change
the actual example code behavior.
|**1**| Game loads |**App.Ready**| Game is fully interactive |
87
90
|**2**| Player clicks “Start Game” |**Journey.Start**| Begins a new session |
88
-
|**3**| Player completes Level 1(of 5 levels) |**Journey.Progress**|`progress: 0.2`|
91
+
|**3**| Player completes Level 1(of 5 levels) |**Journey.Progress**|`progress: 0.2`|
89
92
|**4**| Player opens inventory |**Journey.Interaction**|`action: "menu_opened"`|
90
93
|**5**| Player completes Level 2 |**Journey.Progress**|`progress: 0.4`|
91
94
|**6**| Player reaches final level |**Journey.Progress**|`progress: 0.9`|
@@ -98,7 +101,7 @@ By instrumenting these moments, you can track session boundaries, understand pla
98
101
|**1**| Game loads |**App.Ready**| Game is fully interactive |
99
102
|**2**| Player clicks “Start Game” |**Journey.Start**| Begins a new session |
100
103
|**3**| Player completes early level |**Journey.Progress**|`progress: 0.3`|
101
-
|**4**| Player dies |**Journey.End**|`complete: false`, `win: false`|
104
+
|**4**| Player dies |**Journey.End**|`complete: false`, `win: false`|
102
105
103
106
### Scenario 3: early exit / abandonment
104
107
@@ -149,7 +152,7 @@ Here's how to implement journey tracking in your app.
149
152
150
153
Set Journeys permissions to `true` in `devvit.json`.
151
154
152
-
```
155
+
```json title="devvit.json"
153
156
"permissions": {
154
157
"journeys": true
155
158
},
@@ -159,7 +162,7 @@ Set Journeys permissions to `true` in `devvit.json`.
159
162
160
163
You can send events solely on the backend and use the front‑end only to establish and pass along the journeyId. To do this, thread the active `journey ID` from your front‑end to your backend routes.
If you don’t want to manually send server-events, you can use the generic client side events. In this case, the `JourneyId` is handled. In this case, you won’t need to pass a `JourneyId` when calling progress and so forth. You also won’t need `telemetry.getActiveJourneyId()` unless you’re curious about that data.
218
266
219
267
Note: This also requires using the route adapters provided in `@devvit/analytics/server/reddit`
@@ -144,7 +144,7 @@ import { notifications } from '@devvit/notifications';
144
144
145
145
To send a push notification to a group of users, you can use the double curly brackets ( { { } } ) to reference variables in a Mustache template.
146
146
147
-
```
147
+
```ts
148
148
awaitnotifications.enqueue({
149
149
title: 'Hello {{name}}!',
150
150
body: 'You have {{score}} new points.',
@@ -179,7 +179,7 @@ await notifications.enqueue({
179
179
180
180
**Note:** Mustache templating is optional. Here's a simplified example without it:
181
181
182
-
```
182
+
```ts
183
183
awaitnotifications.enqueue({
184
184
title: 'Winner!',
185
185
body: 'Congrats on your win',
@@ -189,6 +189,7 @@ await notifications.enqueue({
189
189
link: 't3_xyz987',
190
190
},
191
191
],
192
+
});
192
193
```
193
194
194
195
**Note**: If the app hasn’t been published, you can only send push notifications to yourself for testing. **Pre-release apps in testing are not subject to the rate-limits below**.
@@ -204,14 +205,14 @@ If you need higher limits, let us know.
204
205
205
206
Users will be able to opt in or out of receiving notifications triggered by a button in your UI:
206
207
207
-
```
208
+
```ts
208
209
awaitnotifications.optInCurrentUser();
209
210
awaitnotifications.optOutCurrentUser();
210
211
```
211
212
212
213
You will also be able to retrieve a list of users who have opted in (if not managing it manually):
0 commit comments