Langsung ke konten
Skillpedia
Analisis & spreadsheet41k ยท #6902

exploring-autocapture-events

Fungsinya

Skill ini menjelajahi event klik, formulir, dan perubahan halaman otomatis yang dicatat PostHog dari situs web Anda. Ditujukan untuk analis dan tim produk yang ingin tahu apa yang diklik pengguna dan ingin membuat tindakan dari klik tersebut.

Kapan dipakai

  • โœ“Saat Anda ingin mengetahui apa yang diklik pengguna di situs web Anda.
  • โœ“Saat Anda memerlukan selector CSS yang andal untuk tombol atau tautan guna membuat tindakan.
  • โœ“Saat Anda ingin membuat tindakan dari sebuah klik tanpa menulis kode.

Link skill

https://github.com/PostHog/posthog/blob/master/products/product_analytics/skills/exploring-autocapture-events/SKILL.md

Salin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.

Cara pakai

Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.

Pesan siap tempel

Gunakan skill ini untuk membantu saya: https://github.com/PostHog/posthog/blob/master/products/product_analytics/skills/exploring-autocapture-events/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit โ†’

Contoh permintaan ke AI

โ€œApa yang diklik pengguna di halaman harga kami, dan bagaimana cara membuat selector yang andal untuk tombol daftar?โ€

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Skill membaca elemen yang diklik dan dicatat bersama setiap event, memeriksa apakah sebuah selector hanya cocok dengan satu elemen, dan menjalankan kueri pada klik yang cocok. Setelah itu, skill dapat membantu Anda membuat tindakan.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.

Exploring autocapture events

if users opt in then posthog-js automatically captures clicks, form submissions, and page changes as $autocapture events. Each event records the clicked DOM element and its ancestors in the elements_chain column.

$autocapture is intentionally excluded from the posthog:read-data-schema taxonomy because it is only useful with autocapture-specific filters (selector, tag, text, href). This skill fills that gap.

Materialized columns

The events table provides fast access to common element fields without parsing the full chain string.

Column Type Description
elements_chain String Full semicolon-separated element chain (see format reference)
elements_chain_href String Last href value from the chain
elements_chain_texts Array(String) All text values from elements
elements_chain_ids Array(String) All id attribute values
elements_chain_elements Array(String) Useful tag names: a, button, input, select, textarea, label

Use materialized columns for exploration queries whenever possible โ€” they avoid regex parsing.

Canonical autocapture properties

Every $autocapture event from posthog-js ships with a fixed set of properties. Do not query the schema to "look them up" โ€” they are these:

Property Examples Notes
$event_type click, submit, change the kind of interaction
$el_text Sign up, Submit text of the clicked element
$current_url https://app.example.com/pricing page the interaction happened on
$elements_chain semicolon-separated chain parsed via the elements_chain* materialized columns above

Standard event properties ($browser, $os, $device_type, etc.) are also present.

Workflow

1. Confirm autocapture data exists

Run a count query before doing anything else. If the count is zero, autocapture may be disabled. There are two ways this happens:

  • Project settings โ€” the team can set autocapture_opt_out in PostHog project settings
  • SDK config โ€” the posthog-js init() call can pass autocapture: false

Tell the user if no data is found so they can check both settings.

SELECT count() as cnt
FROM events
WHERE event = '$autocapture'
  AND timestamp > now() - INTERVAL 7 DAY

2. Explore what users are interacting with

Start broad using the materialized columns. The goal is to understand what users are clicking before narrowing down.

Useful explorations:

  • Top clicked tag names (via elements_chain_elements)
  • Top clicked text values (via elements_chain_texts)
  • Top clicked hrefs (via elements_chain_href)
  • Raw elements_chain values for a specific page (filtered by properties.$current_url)

See example queries for all patterns.

3. Find candidate selectors

Once the user identifies an interaction they care about, find a CSS selector that identifies it.

Priority order for selector attributes (best first):

  1. data-attr or other data-* attributes โ€” highest specificity, stable across deploys, developer-intended anchors. Search with match(elements_chain, 'data-attr=') or extractAll.
  2. Element ID (attr_id) โ€” also highly stable, queryable via elements_chain_ids.
  3. Tag + class combination โ€” moderately stable but classes change with CSS refactors.
  4. Text content โ€” fragile (changes with copy edits, i18n) but sometimes the only option.
  5. Tag name alone โ€” too broad on its own, useful as a qualifier.

When a

Pertanyaan umum

Apa yang dicatat autocapture?

Jika fitur ini diaktifkan di situs web, PostHog mencatat klik, pengiriman formulir, dan perubahan halaman sebagai event autocapture.

Apa itu rantai elemen?

Itu adalah catatan tentang elemen yang diklik beserta induknya, yang dibaca skill untuk menemukan selector.

Mengapa skill memeriksa keunikan selector?

Selector yang cocok dengan banyak elemen akan menghitung klik yang tidak ingin Anda lacak, sehingga skill memeriksa setiap selector terlebih dahulu.

Detail

Deskripsi asli dari pembuat

Guides exploration of $autocapture events captured by posthog-js to understand user interactions, find CSS selectors (especially data-attr attributes), evaluate selector uniqueness, query matching clicks ad-hoc, and create actions. Use when the user asks about autocapture data, wants to find what users are clicking, needs to build actions from click events, asks about elements_chain, wants to build a trend or funnel filtered by clicks or other autocapture interactions, asks which properties autocapture sends, or asks how to filter $autocapture events. Only applies to projects using posthog-js

repo: PostHog/posthog

Popularitas

Bintang GitHub
41k
Peringkat
#6902
Lisensi
โ€”
Diperbarui
2/11/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • โ€ฆ

Skill lain dari repositori ini

Skill serupa