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
@@ -136,7 +136,7 @@ Use our [SDKs](/sdk) (JS and, Python or use [`apify actor charge`](/cli/docs/nex
136
136
137
137
### Use synthetic start event `apify-actor-start`
138
138
139
-
:::info Synthetic Actor recommended
139
+
:::info Synthetic Actor start event recommended
140
140
141
141
We recommend using the synthetic Actor start event in PPE Actors. It benefits both you and your users.
142
142
@@ -179,13 +179,28 @@ Your Actor might already have a start event defined, such as `actor-start` or an
179
179
180
180
If you want to use the synthetic start event, remove the existing start event from your Actor and add the synthetic start event in Apify Console in the **Publication** tab.
181
181
182
+
### Use synthetic default dataset item event `apify-actor-default-dataset-item`
183
+
184
+
::::info Automatic per-item charging
185
+
186
+
The `apify-actor-default-dataset-item` synthetic event charges users for each item written to the run's default dataset. It lets you align PPE pricing with per-result use cases without adding charging code to your Actor.
187
+
188
+
::::
189
+
190
+
#### How the synthetic default dataset item event works
191
+
192
+
- Apify automatically charges this event whenever your Actor writes an item to the default dataset (for example, when using `Actor.pushData` without opening a named dataset).
193
+
- No code changes are required to charge this event.
194
+
- You can remove the event in Apify Console if you don't want automatic charging for default dataset items. If you remove it, default dataset writes will no longer be charged automatically.
195
+
- The event applies only to the default dataset of the run. Writes to other (non-default) datasets are not charged by this synthetic event.
196
+
182
197
### Set memory limits
183
198
184
199
Set memory limits using `minMemoryMbytes` and `maxMemoryMbytes` in your [`actor.json`](https://docs.apify.com/platform/actors/development/actor-definition/actor-json) file to control platform usage costs.
185
200
186
201
```json
187
202
{
188
-
"actorSpecification": 1,
203
+
"actorSpecification": 1,
189
204
"name": "name-of-my-scraper",
190
205
"version": "0.0",
191
206
"minMemoryMbytes": 512,
@@ -213,15 +228,15 @@ import { Actor } from 'apify';
213
228
214
229
constprocessUrl=async (url) => {
215
230
constresponse=awaitfetch(url);
216
-
231
+
217
232
if (response.status===404) {
218
233
// Charge for the work done and return error item in one call
219
234
awaitActor.pushData({
220
235
url: url,
221
236
error:"404",
222
237
errorMessage:"Page not found"
223
238
}, 'scraped-result');
224
-
239
+
225
240
return;
226
241
}
227
242
@@ -232,7 +247,7 @@ await Actor.init();
232
247
233
248
constinput=awaitActor.getInput();
234
249
const { urls } = input;
235
-
250
+
236
251
for (consturlof urls) {
237
252
awaitprocessUrl(url);
238
253
}
@@ -251,30 +266,30 @@ import requests
251
266
252
267
asyncdefprocess_url(url):
253
268
response = requests.get(url)
254
-
269
+
255
270
if response.status_code ==404:
256
271
# Charge for the work done and return error item in one call
257
272
await Actor.push_data({
258
273
'url': url,
259
274
'error': '404',
260
275
'errorMessage': 'Page not found'
261
276
}, 'scraped-result')
262
-
277
+
263
278
return
264
279
265
280
# Rest of the process_url function
266
281
267
282
asyncdefmain():
268
283
await Actor.init()
269
-
284
+
270
285
input_data =await Actor.get_input()
271
286
urls = input_data.get('urls', [])
272
-
287
+
273
288
for url in urls:
274
289
await process_url(url)
275
-
290
+
276
291
# Rest of the Actor logic
277
-
292
+
278
293
await Actor.exit()
279
294
```
280
295
@@ -294,7 +309,7 @@ However, we acknowledge that some events don't produce tangible results (such as
294
309
Examples:
295
310
296
311
-_`post` event_: Each charge adds one social media post to the dataset
297
-
-_`profile` event_: Each charge adds one user profile to the dataset
312
+
-_`profile` event_: Each charge adds one user profile to the dataset
298
313
-_`processed-image` event_: Each charge adds one processed image to the dataset
299
314
-_`ai-analysis` event_: Each charge processes one document through an AI workflow (no tangible output, but valuable processing)
0 commit comments