apptvty 0.1.5 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -17
- package/dist/chunk-GMQN6656.mjs +1096 -0
- package/dist/chunk-GMQN6656.mjs.map +1 -0
- package/dist/{chunk-OZAZWZNO.mjs → chunk-JNM4IJDR.mjs} +63 -34
- package/dist/chunk-JNM4IJDR.mjs.map +1 -0
- package/dist/chunk-OZT7PIDN.mjs +178 -0
- package/dist/chunk-OZT7PIDN.mjs.map +1 -0
- package/dist/cli.js +94 -9
- package/dist/index.d.mts +138 -20
- package/dist/index.d.ts +138 -20
- package/dist/index.js +389 -38
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -3
- package/dist/middleware/express.d.mts +24 -5
- package/dist/middleware/express.d.ts +24 -5
- package/dist/middleware/express.js +675 -7
- package/dist/middleware/express.js.map +1 -1
- package/dist/middleware/express.mjs +4 -2
- package/dist/middleware/nextjs.d.mts +29 -6
- package/dist/middleware/nextjs.d.ts +29 -6
- package/dist/middleware/nextjs.js +640 -33
- package/dist/middleware/nextjs.js.map +1 -1
- package/dist/middleware/nextjs.mjs +4 -2
- package/dist/setup.d.mts +9 -0
- package/dist/setup.d.ts +9 -0
- package/dist/setup.js +6 -2
- package/dist/setup.js.map +1 -1
- package/dist/setup.mjs +6 -2
- package/dist/setup.mjs.map +1 -1
- package/dist/{types-C1oUTCsT.d.mts → types-Zt2qHOrW.d.mts} +122 -2
- package/dist/{types-C1oUTCsT.d.ts → types-Zt2qHOrW.d.ts} +122 -2
- package/package.json +1 -1
- package/dist/chunk-3ITWIW4P.mjs +0 -87
- package/dist/chunk-3ITWIW4P.mjs.map +0 -1
- package/dist/chunk-JVOMOEEL.mjs +0 -509
- package/dist/chunk-JVOMOEEL.mjs.map +0 -1
- package/dist/chunk-OZAZWZNO.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -259,6 +259,21 @@ The `sponsored` field is present only when ads are enabled for your site and a m
|
|
|
259
259
|
}
|
|
260
260
|
```
|
|
261
261
|
|
|
262
|
+
---
|
|
263
|
+
|
|
264
|
+
## Advertiser funding (X402)
|
|
265
|
+
If you are an agent or company paying for ads, Apptvty supports autonomous pre-paid credits via USDC on Base.
|
|
266
|
+
|
|
267
|
+
1. **Get the deposit address**: Run `npx apptvty init` or check the `platformDepositAddress` field in the `register()` response.
|
|
268
|
+
2. **Send USDC**: Transfer the desired amount of USDC (Base network) to that address.
|
|
269
|
+
3. **Sync your balance**: Call the wallet sync endpoint with your transaction hash:
|
|
270
|
+
```bash
|
|
271
|
+
curl "https://api.apptvty.com/v1/wallet/sync?tx_hash=0x..."
|
|
272
|
+
```
|
|
273
|
+
*Note: On-chain verification takes ~30-60 seconds.*
|
|
274
|
+
|
|
275
|
+
---
|
|
276
|
+
|
|
262
277
|
Response headers always include:
|
|
263
278
|
- `Content-Type: application/json`
|
|
264
279
|
- `Cache-Control: no-store`
|
|
@@ -278,25 +293,12 @@ const client = new ApptvtyClient({
|
|
|
278
293
|
siteId: process.env.APPTVTY_SITE_ID!,
|
|
279
294
|
});
|
|
280
295
|
|
|
281
|
-
// 30-day overview
|
|
282
|
-
const stats = await client.getSiteStats();
|
|
283
|
-
console.log(`AI traffic: ${stats.ai_percentage}%`);
|
|
284
|
-
|
|
285
|
-
// Recent activity (last hour)
|
|
286
|
-
const { activity } = await client.getSiteActivity(20);
|
|
287
|
-
activity.forEach(a => console.log(a.path, a.crawler_type, a.status_code));
|
|
288
|
-
|
|
289
|
-
// Recent agent queries
|
|
290
|
-
const { queries } = await client.getSiteQueries(10);
|
|
291
|
-
|
|
292
|
-
// Crawler breakdown
|
|
293
|
-
const { crawlers } = await client.getSiteCrawlers(7);
|
|
294
|
-
|
|
295
|
-
// Daily stats
|
|
296
|
-
const { stats: daily } = await client.getSiteDailyStats(30);
|
|
297
|
-
|
|
298
296
|
// Wallet balance
|
|
299
297
|
const wallet = await client.getSiteWallet();
|
|
298
|
+
|
|
299
|
+
// Ad Campaign Insights (for advertisers)
|
|
300
|
+
const insights = await client.getCampaignInsights('camp_123');
|
|
301
|
+
console.log(`Top site: ${insights.top_publishers[0].domain}`);
|
|
300
302
|
```
|
|
301
303
|
|
|
302
304
|
| Method | Returns |
|
|
@@ -307,6 +309,24 @@ const wallet = await client.getSiteWallet();
|
|
|
307
309
|
| `getSiteQueries(limit?)` | Recent agent queries |
|
|
308
310
|
| `getSiteCrawlers(days?)` | Crawler type breakdown |
|
|
309
311
|
| `getSiteWallet()` | Balance, earnings, spend |
|
|
312
|
+
| `getCampaignInsights(id)` | Ad performance (impressions per site, daily spend) |
|
|
313
|
+
|
|
314
|
+
---
|
|
315
|
+
|
|
316
|
+
## Local logs dashboard
|
|
317
|
+
Deploy a localized analytics portal on your own domain using the framework-agnostic dashboard handler.
|
|
318
|
+
|
|
319
|
+
### Next.js (App Router)
|
|
320
|
+
```typescript
|
|
321
|
+
// app/api/apptvty/logs/route.ts
|
|
322
|
+
import { createNextjsDashboardHandler } from 'apptvty/nextjs';
|
|
323
|
+
|
|
324
|
+
export const GET = createNextjsDashboardHandler({
|
|
325
|
+
apiKey: process.env.APPTVTY_API_KEY!,
|
|
326
|
+
siteId: process.env.APPTVTY_SITE_ID!,
|
|
327
|
+
});
|
|
328
|
+
```
|
|
329
|
+
Your dashboard is now available at `https://yoursite.com/api/apptvty/logs`.
|
|
310
330
|
|
|
311
331
|
---
|
|
312
332
|
|