Measure Blog-to-Product Attribution With PostHog and Codex

Measure Blog-to-Product Attribution With PostHog and Codex

Aident AI

A luminous path crosses separate cyan, amber, and coral attribution checkpoints on a dark field.

Measure Blog-to-Product Attribution With PostHog and Codex

Measure blog-to-product attribution as three separate views: first touch, assisted progression, and last touch. Do not collapse them into one “the blog caused this conversion” number. PostHog can connect pageviews and downstream events for the same identified visitor, while Codex can discover the live query Action, inspect its schema, preflight the exact request, and run a reproducible read-only analysis.

The result is evidence about sequence and association. It is not proof that the article caused the later action.

The Three Views Answer Different Questions

View

Question it answers

What you can claim

First touch

Was this article the visitor's earliest known source or content interaction?

The article introduced the identified visitor within the observed history.

Assisted progression

Did the visitor read this article before a named product event within a fixed window?

The article appeared earlier in the visitor's measured journey.

Last touch

Was this article the visitor's final qualifying pageview before the product event?

The article was the most recent measured content interaction under your rule.

None of these views proves incremental lift. A returning visitor may have seen an untracked recommendation, used another device, cleared cookies, or already intended to try the product. If you need causality, use a controlled experiment or a credible holdout design.

Define the Event Contract Before You Query

Write down the contract first. Otherwise, a precise query can still produce a misleading answer.

  1. Canonical blog scope: use exact canonical paths or one explicit path prefix. Decide whether translated pages, query strings, and trailing slashes map to the same article.

  2. Downstream event: name one observable step, such as a visit to /SETUP.md, setup_started, integration_connected, or activation_completed. Do not substitute a product-page visit for an activation.

  3. Identity: choose the PostHog distinct_id or person identity available in both event sets. Document what happens before and after login or identity merging.

  4. Window: declare the attribution window and timezone. Seven days is useful for a quick progression check, but it is a policy choice rather than a universal default.

  5. Exclusions: remove internal traffic, known bots, synthetic checks, preview domains, and test accounts with explicit filters.

  6. Campaign metadata: tag the article CTA with stable utm_source, utm_medium, and utm_campaign values so the link itself remains auditable.

Keep those definitions next to the query and result. A result without its event contract cannot be reproduced or compared safely.

Connect PostHog Without Copying Credentials Into a Prompt

Install Aident Loadout by giving Codex this exact instruction:

Follow https://aident.ai/SETUP.md

Then verify the signed-in account and Vault connection before discovery:

aident account auth status
aident vault vault --action status

Search by the job rather than guessing an Action identifier:

aident capabilities search \
  --query "PostHog list projects and run a read-only HogQL query" \
  --types '["action"]' \
  --targetEnv staging

Use the exact public Action name returned by search. Inspect its current input schema, preflight the full input, and execute only after the project, time bounds, and SQL match the reviewed contract. An HTTP POST can still be read-only when it submits a query body, but verify the operation description instead of inferring safety from the verb.

Start With an Exact-Page Baseline

Count pageviews and unique visitors for one canonical article over complete days. Parameterize the dates and path rather than letting an agent silently choose them.

SELECT
    count() AS pageviews,
    uniq(distinct_id) AS visitors
FROM events
WHERE event = '$pageview'
  AND timestamp >= toDateTime('2026-07-14 00:00:00')
  AND timestamp < toDateTime('2026-08-11 00:00:00')
  AND properties.$current_url = 'https://example.com/blog/example-article'

Read back the SQL, project ID, timezone, inclusive start, exclusive end, and returned counts. This is the denominator for later progression rates, not an attribution result by itself.

Measure Assisted Product Progression

The following HogQL pattern asks whether a visitor to a canonical blog page later reached a named product path within seven days. Replace both URLs, dates, and the window with your reviewed contract.

WITH blog_visitors AS (
    SELECT
        distinct_id,
        min(timestamp) AS first_blog_view
    FROM events
    WHERE event = '$pageview'
      AND timestamp >= toDateTime('2026-07-14 00:00:00')
      AND timestamp < toDateTime('2026-08-11 00:00:00')
      AND properties.$current_url = 'https://example.com/blog/example-article'
    GROUP BY distinct_id
),
product_visitors AS (
    SELECT
        blog_visitors.distinct_id,
        min(events.timestamp) AS first_product_view
    FROM blog_visitors
    INNER JOIN events
        ON events.distinct_id = blog_visitors.distinct_id
    WHERE events.event = '$pageview'
      AND events.timestamp > blog_visitors.first_blog_view
      AND events.timestamp <= blog_visitors.first_blog_view + INTERVAL 7 DAY
      AND events.properties.$current_url = 'https://example.com/product'
    GROUP BY blog_visitors.distinct_id
)
SELECT
    (SELECT count() FROM blog_visitors) AS blog_visitors,
    (SELECT count() FROM product_visitors) AS progressed_visitors,
    progressed_visitors / blog_visitors AS progression_rate

Call the output assisted product progression, not conversions, unless the downstream event is an actual verified conversion. A page path is navigation evidence. It does not establish a signup, payment, activation, or causal lift.

Add First Touch and Last Touch Without Mixing Them

PostHog captures referrer and UTM properties and documents first- and last-touch patterns. Keep each model in a separate query or output column.

For first touch, find the earliest known pageview or acquisition event for each person and test whether the canonical article was that event. State how much history the query can see. “First touch in the last 90 days” is not the same as the person's first touch ever.

For last touch, locate the final qualifying pageview before the downstream event. Decide whether only blog pages qualify or whether pricing, documentation, and the homepage can receive last-touch credit. If the rule changes, start a new comparable series rather than rewriting old results.

Assisted progression is intentionally broader. It asks whether the article appeared anywhere before the event within the declared window. One journey can therefore count as assisted by multiple pages, but it should have only one first touch and one last touch under a deterministic rule.

Aident's Current Baseline Shows Why the Distinction Matters

In a read-only PostHog query covering July 14 through August 10, 2026, Aident's blog portfolio recorded 1,724 pageviews from 1,562 unique distinct_id values. Of those visitors, 21 later reached a declared product path within seven days, an assisted navigation rate of about 1.34%.

That result does not say 21 people signed up, paid, or would have failed to progress without a blog visit. It establishes a reproducible navigation baseline and exposes the next instrumentation question: which downstream event represents a meaningful product outcome?

Search Console told a separate, complementary story over the same latest complete 28-day window. Nonbranded blog clicks were 185 from 8,026 impressions, compared with 7 clicks from 4,842 impressions in the preceding equal period. Search discovery improved sharply, but search acquisition and product progression remain different measurements. Reporting one as proof of the other would erase the most important part of the funnel.

Make the Result Auditable

Have Codex return a compact evidence packet with every run:

  • the PostHog project name and numeric ID;

  • the exact query text and Action version;

  • the timezone and complete date bounds;

  • the article path, downstream event, and attribution window;

  • the exclusion and identity rules;

  • the preflight price or credit quote;

  • the raw counts before any percentage calculation; and

  • a read-only confirmation that no insight, dashboard, cohort, or flag was changed.

Store the result as a dated snapshot. Do not overwrite a prior number when the query contract changes. Comparing two different event definitions as if they were a trend is worse than having no trend at all.

Common Attribution Failures

Calling every downstream pageview a conversion

A product-page visit is a useful consideration metric. It is not an account creation, connected integration, activation, qualified opportunity, or payment. Name the metric after the event you actually measured.

Losing identity at login or across devices

Anonymous and identified events may use different IDs until they are merged. Cross-device journeys may remain separate. Report the measured identity boundary instead of assuming every person is unified.

Letting an agent choose an open-ended query

Require one project, bounded dates, exact paths, and a read-only operation. Preflight the complete input. Large scans are slower, harder to review, and easier to misinterpret.

Mixing first, assisted, and last touch in one headline

These models allocate evidence differently. Publish them side by side with their definitions. Do not select whichever number makes the article look best.

Treating association as causation

Attribution organizes observed journeys. It cannot recover unobserved exposures or the counterfactual outcome. Use experiments for causal claims.

Run One Bounded Attribution Query

Follow https://aident.ai/SETUP.md

Set up Aident Loadout and run the attribution query

For the general discovery, schema, preflight, and execution loop, read How to Use Aident Loadout. To connect search demand with product evidence, continue with How AI Agents Turn SEO Research Into Product Growth.

Sources

Refresh this guide when the PostHog event contract, identity policy, product-path definition, attribution window, Loadout Action schema, or preflight pricing changes.

Home

Home

Home

Integrations

Integrations

Integrations

Vault

Vault

Vault

Audit

Audit

Audit

Arana Grande

Arana Grande

Arana Grande

Free

Free

Free

30-day audit summary

30-day audit summary

30-day audit summary

Daily action-call volume and the latest receipts from the Loadout audit trail.

Daily action-call volume and the latest receipts from the Loadout audit trail.

Daily action-call volume and the latest receipts from the Loadout audit trail.

View Audit

View Audit

View Audit

Loadout usage

Loadout usage

Loadout usage

617 action calls in the last 30 days

617 action calls in the last 30 days

617 action calls in the last 30 days

May 19 - Jun 17

May 19 - Jun 17

May 19 - Jun 17

10 active days

10 active days

10 active days

Less

Less

Less

More

More

More

Recent activity

Recent activity

Recent activity

Latest action-call receipts from connected agents

Latest action-call receipts from connected agents

Latest action-call receipts from connected agents

Apr 23, 09:23 AM

Apr 23, 09:23 AM

Apr 23, 09:23 AM

Shopify

Shopify

Shopify

Creates Or Updates An Asset For A Theme

Creates Or Updates An Asset For A Theme

Creates Or Updates An Asset For A Theme

Success

Success

Success

Apr 23, 09:21 AM

Apr 23, 09:21 AM

Apr 23, 09:21 AM

Shopify

Shopify

Shopify

Update Products Param Product Id

Update Products Param Product Id

Update Products Param Product Id

Success

Success

Success

Apr 23, 08:53 AM

Apr 23, 08:53 AM

Apr 23, 08:53 AM

Shopify

Shopify

Shopify

Update Products Param Product Id

Update Products Param Product Id

Update Products Param Product Id

Failed

Failed

Failed

Apr 22, 22:13 PM

Apr 22, 22:13 PM

Apr 22, 22:13 PM

Shopify

Shopify

Shopify

Create Product Image

Create Product Image

Create Product Image

Success

Success

Success

Apr 22, 22:12 PM

Apr 22, 22:12 PM

Apr 22, 22:12 PM

Shopify

Shopify

Shopify

Create Product Image

Create Product Image

Create Product Image

Success

Success

Success

Connected integration coverage

Connected integration coverage

Connected integration coverage

162

162

162

of 753 accessible connected

of 753 accessible connected

of 753 accessible connected

Callable actions

Callable actions

Callable actions

1,126

1,126

1,126

Vault credentials

Vault credentials

Vault credentials

8

8

8

Explore what's possible

Explore what's possible

Explore what's possible

See all Integrations

See all Integrations

See all Integrations

Google Ads

Google Ads

Google Ads

All available Goolge Ads tools via...

All available Goolge Ads tools via...

All available Goolge Ads tools via...

X (twitter)

X (twitter)

X (twitter)

All available X tools via...

All available X tools via...

All available X tools via...

Github

Github

Github

All available Github tools via...

All available Github tools via...

All available Github tools via...

Notion

Notion

Notion

All available Notion tools via...

All available Notion tools via...

All available Notion tools via...

Slack

Slack

Slack

All available Slack tools via...

All available Slack tools via...

All available Slack tools via...

Firecrawl

Firecrawl

Firecrawl

All available Firecrawl tools via...

All available Firecrawl tools via...

All available Firecrawl tools via...

753 integrations are available for loadouts.

753 integrations are available for loadouts.

753 integrations are available for loadouts.

The one tool

for every tool

your agent needs.

Give any AI agent real capabilities in seconds. Connect 1,000+ tools once, skip the setup headache, and let your agents execute.

Try Aident Loadout

Give your Agent real capabilities in minutes. Connect 1,000+ tools, and let your agents execute.

Try Aident Loadout

Give your Agent real capabilities in minutes. Connect 1,000+ tools, and let your agents execute.

Try Aident Loadout

Give your Agent real capabilities in minutes. Connect 1,000+ tools, and let your agents execute.