---
url: https://simpledatalogs.com/docs/agents/recipes.md
description: >-
  Ready-to-paste prompts for coding agents to add simpledatalogs to Laravel, iOS
  and macOS, websites, Node, OpenTelemetry and Sentry setups, and to read
  numbers back over MCP.
---

# Prompt recipes

Paste one of these into your coding agent, in your app's repository. Each assumes the key is in an environment variable or your build config; replace `<…>` with your details.

::: tip Give the agent the docs
Every recipe starts by pointing the agent at the docs as Markdown. Agents that can't fetch URLs work just as well if you paste the linked page, using the **Copy page** button at the top of it.
:::

## Add simpledatalogs to a Laravel app

```text
Read https://simpledatalogs.com/docs/sdks/laravel.md.
Add simpledatalogs to this Laravel app:
1. Install simpledatalogs/laravel and publish its config.
2. Add SIMPLEDATALOGS_KEY to .env.example (empty) and tell me to set it to my sdl_sec_ key.
3. Tap the `daily` channel in config/logging.php with ForwardToSimpleDataLogs, named "app".
4. Schedule `simpledatalogs:ship` every minute without overlapping.
5. Add any context keys that could hold personal data to drop_context_keys.
Then show me the diff.
```

## Add event tracking to an iOS or macOS app

```text
Read https://simpledatalogs.com/docs/sdks/swift.md.
Add the SimpleDataLogs Swift package to this app and track:
- app_launched (props: app_version)
- the main action of the app, named <thing>_<done>
- errors the user sees, as <area>_failed with a `reason` prop
Configure it once at launch in the app delegate, after setEnabled(<our analytics opt-in setting>).
Use a random install id stored in UserDefaults as the device id. The key comes from <build setting>.
```

## Add analytics to a website

```text
Read https://simpledatalogs.com/docs/sdks/javascript.md.
Add simpledatalogs to this site with the `simpledatalogs` package and a public key from <env var>.
Track page_view on every route change (props: path without query string), signup_started, signup_completed.
Create the client once in a shared module. Don't track anything before the cookie/consent choice allows it; call setEnabled(false) when it doesn't.
```

## Add logging to a Node service

```text
Read https://simpledatalogs.com/docs/sdks/javascript.md.
In this Node service, create one simpledatalogs client with the secret key from SIMPLEDATALOGS_KEY.
Send our existing error logs with sdl.log('error', error, { route, status }) next to the current logger,
track job_finished with queue and duration_ms, and call `await sdl.shutdown()` on SIGTERM.
```

## Switch an OpenTelemetry setup

```text
Read https://simpledatalogs.com/docs/integrations/opentelemetry.md.
Point this service's OpenTelemetry logs at simpledatalogs using environment variables only.
Turn off the traces and metrics exporters, use gzip, and put the key in the deployment config, not in code.
```

## Switch from Sentry

```text
Read https://simpledatalogs.com/docs/integrations/sentry.md.
Change our Sentry DSN to send to simpledatalogs instead, set the traces sample rate to 0,
and make sure the transport uses gzip. Don't change any capture calls.
```

## Write a sender for another language

```text
Read https://simpledatalogs.com/docs/api/sender-rules.md and https://simpledatalogs.com/docs/api/responses.md.
There is no SDK for <language>. Write a small simpledatalogs client for this app that follows all six sender rules:
batching, a durable outbox in <storage>, backoff with full jitter honoring Retry-After, event_id and ts set at track time,
failing open, and a User-Agent. Handle 401 (pause, keep), 413 (split) and 415 (set aside). Add tests with a fake HTTP server.
```

## Review tracking for personal data

```text
Read https://simpledatalogs.com/docs/reference/privacy.md.
Find every simpledatalogs tracking and logging call in this repo and list any that could send personal data
(emails, names, IPs, tokens, free text, ids in URLs). Propose a fix for each.
```

## Read your numbers back

With the [MCP server](/mcp/) connected, ask questions like these in any chat or coding agent:

```text
Using simpledatalogs, how many screenshot_taken events did production get each day this week, and how many devices?
```

```text
List the error logs from the last 24 hours in production, grouped by message. Which one is new?
```

```text
I just added the export_finished event. Check development: has it arrived, and with which props?
```

```text
Compare the last 7 days with the 7 before for every event in production, and tell me what changed the most.
```

## Next steps

* [AGENTS.md snippet](/agents/agents-md): keep the rules in your repo.
* [Tools reference](/mcp/tools): what the MCP server can answer.
