# Analytics and consent

> Analytics and consent is an open-source agent skill for developer tools. Gates React Native app analytics behind opt-in consent, with typed, personal-data-free. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf, Goose
- **Website:** https://github.com/zakariaf/ReactNative-Skills/tree/main/skills/analytics-and-consent
- **Repository:** https://github.com/zakariaf/reactnative-skills
- **GitHub stars:** 16
- **License:** MIT
- **Skill name:** analytics-and-consent
- **Collection:** https://github.com/zakariaf/ReactNative-Skills
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-04

## About

This skill sets up product analytics for an Expo app so that nothing is sent and no vendor SDK is created until the user agrees. It adds a consent gate that can be revoked from a settings row, with withdrawal that resets and opts out the SDK and clears stored identifiers, and a forget step for account deletion. It also asks again when the consent question changes.

Events come from a typed catalog where each event has a stated purpose and only enum, boolean, bucketed count or route properties are allowed, so free text and identifiers are dropped before sending. Screen views are recorded as route patterns, and analytics stays anonymous unless the contract declares identification. Ads consent and App Tracking Transparency are kept separate from analytics, and the skill sets up build modes and environment keys so test and audit builds send nothing.

The workflow uses PostHog as the default vendor and includes templates, examples and two Node checkers that verify the code and the store privacy declarations. Inputs include a choice of vendor region, audience and whether users are identified. Apps for children are excluded from third-party analytics.

## When your agent uses it

> Gates analytics on opt-in consent: no SDK before a yes, typed events without personal data, ATT. Use when adding analytics, events, screen views or a usage-data toggle. Not for crashes (crash-reporting-and-observability).

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Runs JavaScript and TypeScript scripts](https://github.com/zakariaf/ReactNative-Skills/tree/HEAD/skills/analytics-and-consent)
- [No network calls found in its scripts](https://github.com/zakariaf/ReactNative-Skills/tree/HEAD/skills/analytics-and-consent)
- [License: MIT](https://github.com/zakariaf/ReactNative-Skills/tree/HEAD/skills/analytics-and-consent)

## Features

- **Opt-in consent gate:** Blocks all event sending and delays SDK creation until the user explicitly grants consent.
- **Typed event catalog:** Defines every analytics event with a purpose and closed property types, checked at run time.
- **Personal data filtering:** Drops free-text and identifier-like properties before any event leaves the device.
- **Consent withdrawal and forgetting:** Resets and opts out the SDK on a no, clears stored ids, and wipes consent on account deletion.
- **Route-based screen views:** Records screens by route pattern rather than concrete paths or search parameters.
- **Store declaration generation:** Derives App Store privacy manifest entries and Play Data safety rows from one contract.
- **Static and behaviour checkers:** Two scripts verify the consent flow, lazy SDK creation and privacy rules in the code.

## Good for

- Add opt-in analytics to an Expo app with a usage-data toggle in settings
- Track a new screen or button press with a typed event
- Remove the analytics SDK from startup so it only loads after consent
- Generate App Store and Play privacy answers that match the tracked events
- Wire analytics off for test and end-to-end builds

## Install

### Claude Code

This skill ships in the `react-native` plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

```sh
/plugin marketplace add zakariaf/ReactNative-Skills
/plugin install react-native@react-native-skills
```

Or copy only this skill to `~/.claude/skills/analytics-and-consent`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/zakariaf/ReactNative-Skills.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/analytics-and-consent &&
cp -R "$tmp/skills/analytics-and-consent" ~/.claude/skills/analytics-and-consent &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/analytics-and-consent` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/analytics-and-consent` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/zakariaf/ReactNative-Skills.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/analytics-and-consent &&
cp -R "$tmp/skills/analytics-and-consent" ~/.agents/skills/analytics-and-consent &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/analytics-and-consent` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/analytics-and-consent` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/zakariaf/ReactNative-Skills.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/analytics-and-consent &&
cp -R "$tmp/skills/analytics-and-consent" ~/.cursor/skills/analytics-and-consent &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/analytics-and-consent` inside it instead.

### Gemini CLI

Run in a terminal (add `--scope workspace` to install it for the current workspace only):

```sh
gemini skills install https://github.com/zakariaf/ReactNative-Skills.git --path skills/analytics-and-consent
```

Or copy the folder to `~/.gemini/skills/analytics-and-consent` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/analytics-and-consent`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/zakariaf/ReactNative-Skills.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/analytics-and-consent &&
cp -R "$tmp/skills/analytics-and-consent" ~/.copilot/skills/analytics-and-consent &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/analytics-and-consent` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/zakariaf/ReactNative-Skills.git
```

Then copy `ReactNative-Skills/skills/analytics-and-consent` into your agent's skills folder as `analytics-and-consent`. Agents that support SKILL.md read one folder per skill.

## FAQ

### What does Analytics and consent need to be installed?

It installs the PostHog React Native SDK pinned to version 4.79.1 and expo-application, and it needs an Expo app with a configuration file for the analytics keys.

### When does the consent prompt appear?

The skill asks the user after onboarding and never over a task or at first launch, and it asks again only when the consent question version changes.

### Does Analytics and consent use App Tracking Transparency?

Not by default. Analytics does not track, and ATT is only used if the app explicitly opts into a tracking profile.

### Which tools does Analytics and consent run?

It runs two Node checker scripts plus Jest suites for the analytics code.

### How do I install Analytics and consent in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/analytics-and-consent to use it in all your projects, or to .claude/skills/analytics-and-consent in one project. Or install the react-native plugin, which includes it: /plugin marketplace add zakariaf/ReactNative-Skills, then /plugin install react-native@react-native-skills.

### Does Analytics and consent run scripts?

Yes. It runs JavaScript and TypeScript scripts. No network calls were found in its scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use Analytics and consent?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

### What are the best alternatives to Analytics and consent?

The closest alternatives to Analytics and consent are Crash reporting and observability, Auth and secure storage, Debug menu and test hooks, Expo data fetching and Expo native UI.

## Where this comes from

- Description: from the skill's own SKILL.md.

## Alternatives

- [Crash reporting and observability](https://ai-powered.com/skills/crash-reporting-and-observability): Crash reporting and observability is an open-source agent skill for developer tools.
- [Auth and secure storage](https://ai-powered.com/skills/auth-and-secure-storage): Auth and secure storage is an open-source agent skill for developer tools.
- [Debug menu and test hooks](https://ai-powered.com/skills/debug-menu-and-test-hooks): Debug menu and test hooks is an open-source agent skill for developer tools.
- [Expo data fetching](https://ai-powered.com/skills/expo-data-fetching-scaledockhq): Expo data fetching is an open-source agent skill for developer tools.
- [Expo native UI](https://ai-powered.com/skills/expo-native-ui): Expo native UI is an open-source agent skill for developer tools.
- [Audio and haptics feedback](https://ai-powered.com/skills/audio-and-haptics-feedback): Audio and haptics feedback is an open-source agent skill for developer tools.
- [Expo data fetching](https://ai-powered.com/skills/expo-data-fetching): Expo data fetching is an open-source agent skill for developer tools.
- [Expo router](https://ai-powered.com/skills/expo-router-scaledockhq): Expo router is an open-source agent skill for developer tools.

---
Source: https://ai-powered.com/skills/analytics-and-consent
