Skip to content

feat: build a popular posts section from GA4 pageviews #13

Description

@devFancy

Background

The home page shows only the three most recent posts, so a first-time visitor has no way to tell where to start. Which posts actually get read is already in GA4, but the site does not use it.

Goal

A popular posts section on the home page, ranked by GA4 pageviews.

Plan

  1. Create a service account and give it viewer access to the GA4 property. Keep the key in repository secrets.
  2. At build time, call the GA4 Data API for the top posts over the last 30 days and write the result to JSON.
  3. Add the section to the home page. Exclude the problem-solving posts.

Verify

  • The local build still runs without the secret.
  • If the API call fails, the section is not rendered and the deploy still passes.

Notes

Measurement ID G-7BMWW1711K. This comes after the deploy work.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions