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 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