> ## Documentation Index
> Fetch the complete documentation index at: https://docs.base44.com/llms.txt
> Use this file to discover all available pages before exploring further.

# App Logs モジュール

> `base44.appLogs` を介してアプリ内のユーザーアクティビティをログします。

<Warning>
  このページは AI コーディングエージェントスキルの一部で、人間ではなくエージェント向けに書かれています。人間向けの Base44 ドキュメントは [デベロッパードキュメント](/developers) を参照してください。
</Warning>

# App Logs モジュール

`base44.appLogs` を介してアプリ内のユーザーアクティビティをログします。

## 目次

* [メソッド](#methods)
* [例](#examples)
* [ユースケース](#use-cases)

## メソッド

| メソッド                     | シグネチャ           | 説明                         |
| ------------------------ | --------------- | -------------------------- |
| `logUserInApp(pageName)` | `Promise<void>` | ページ上のユーザーアクティビティをログ        |
| `fetchLogs(params?)`     | `Promise<any>`  | オプションのフィルターパラメーターでアプリログを取得 |
| `getStats(params?)`      | `Promise<any>`  | アプリ使用統計を取得                 |

## 例

### ユーザーアクティビティのログ

```javascript theme={null}
// Log when user visits a page
await base44.appLogs.logUserInApp("dashboard");

// Log specific page visits
await base44.appLogs.logUserInApp("settings");
await base44.appLogs.logUserInApp("profile");

// Log feature usage
await base44.appLogs.logUserInApp("export-button-click");
```

ページ名は実際のページである必要はなく、トラッキングしたい任意の文字列を使用できます。

## ユースケース

### React でのページビューのトラッキング

```javascript theme={null}
// Log page views on route change
useEffect(() => {
  base44.appLogs.logUserInApp(window.location.pathname);
}, [location.pathname]);
```

### 機能使用のトラッキング

```javascript theme={null}
// Log when user uses specific features
function handleExport() {
  base44.appLogs.logUserInApp("export-data");
  // ... export logic
}

function handleSettingsChange() {
  base44.appLogs.logUserInApp("settings-updated");
  // ... save settings
}
```

### ログの取得

```javascript theme={null}
// Fetch all logs
const logs = await base44.appLogs.fetchLogs();

// Fetch logs with filters
const recentLogs = await base44.appLogs.fetchLogs({
  limit: 50,
  page: "/dashboard"
});
```

### 統計の取得

```javascript theme={null}
// Get usage statistics for the app
const stats = await base44.appLogs.getStats();

// Get stats with date range params
const weekStats = await base44.appLogs.getStats({
  from: "2024-01-01",
  to: "2024-01-07"
});
```

## 注意事項

* ログはアプリダッシュボードの Analytics ページに表示されます
* App logs はページレベルおよび機能レベルのアクティビティをトラッキングします
* プロパティを持つカスタムイベントには `analytics.track()`、シンプルなページ/機能トラッキングには `appLogs.logUserInApp()` を使用します

## 型定義

```typescript theme={null}
/** App Logs module for tracking and analyzing app usage. */
interface AppLogsModule {
  /**
   * Log user activity in the app.
   * @param pageName - Name of the page or section being visited.
   * @returns Promise that resolves when the log is recorded.
   */
  logUserInApp(pageName: string): Promise<void>;

  /**
   * Fetch app logs with optional filter parameters.
   * @param params - Optional filter parameters (e.g., limit, page name, date range).
   * @returns Promise resolving to the logs data.
   */
  fetchLogs(params?: Record<string, any>): Promise<any>;

  /**
   * Get app usage statistics.
   * @param params - Optional filter parameters (e.g., date range).
   * @returns Promise resolving to the statistics data.
   */
  getStats(params?: Record<string, any>): Promise<any>;
}
```

<Note>このページは AI を使用して翻訳されました。最も正確で最新の情報については、[英語版](/) を参照してください。 </Note>
