FoPost.Analytics (FoPost v0.1.0)

Copy Markdown View Source

Cross-account reporting.

Every read takes the same window and scope options, and leaves out what you do not pass so the API applies its own default:

  • :workspace_id — narrow to one workspace
  • :account_id — narrow to one account
  • :days — a rolling window, or use :from and :to (both YYYY-MM-DD)
  • :limit, :page — where the endpoint paginates
  • :sort, :label — where the endpoint ranks or groups

For example:

{:ok, overview} = FoPost.Analytics.overview(client, workspace_id: id, days: 30)
overview.total_followers

Summary

Functions

Pulls fresh numbers from the platforms.

An audience breakdown.

A per-label campaign roll-up.

The headline numbers for the window.

A year of posting activity, one entry per day.

Posts with their per-platform delivery breakdown, paginated.

One point per day in the window.

The best performing posts in the window. sort: "recent" orders by date instead.

Functions

collect(client, opts \\ [])

@spec collect(
  FoPost.Client.t(),
  keyword()
) :: {:ok, FoPost.Analytics.CollectSummary.t()} | {:error, FoPost.Error.t()}

Pulls fresh numbers from the platforms.

Rate limited harder than the reads, since every call reaches out to a network. Narrow it with :account_id.

collect!(client, opts \\ [])

Same as collect/2, but raises FoPost.Error.

demographics(client, opts \\ [])

@spec demographics(
  FoPost.Client.t(),
  keyword()
) :: {:ok, FoPost.Analytics.Demographics.t()} | {:error, FoPost.Error.t()}

An audience breakdown.

:audience is "followers" (the default), "engaged", or "reached".

demographics!(client, opts \\ [])

Same as demographics/2, but raises FoPost.Error.

labels(client, opts \\ [])

@spec labels(
  FoPost.Client.t(),
  keyword()
) :: {:ok, [FoPost.Analytics.LabelStats.t()]} | {:error, FoPost.Error.t()}

A per-label campaign roll-up.

labels!(client, opts \\ [])

Same as labels/2, but raises FoPost.Error.

overview(client, opts \\ [])

@spec overview(
  FoPost.Client.t(),
  keyword()
) :: {:ok, FoPost.Analytics.Overview.t()} | {:error, FoPost.Error.t()}

The headline numbers for the window.

overview!(client, opts \\ [])

Same as overview/2, but raises FoPost.Error.

posting_streak(client, opts \\ [])

@spec posting_streak(
  FoPost.Client.t(),
  keyword()
) :: {:ok, [FoPost.Analytics.StreakDay.t()]} | {:error, FoPost.Error.t()}

A year of posting activity, one entry per day.

posting_streak!(client, opts \\ [])

Same as posting_streak/2, but raises FoPost.Error.

posts_table(client, opts \\ [])

@spec posts_table(
  FoPost.Client.t(),
  keyword()
) :: {:ok, FoPost.Analytics.PostsTable.t()} | {:error, FoPost.Error.t()}

Posts with their per-platform delivery breakdown, paginated.

posts_table!(client, opts \\ [])

Same as posts_table/2, but raises FoPost.Error.

time_series(client, opts \\ [])

@spec time_series(
  FoPost.Client.t(),
  keyword()
) :: {:ok, FoPost.Analytics.TimeSeries.t()} | {:error, FoPost.Error.t()}

One point per day in the window.

time_series!(client, opts \\ [])

Same as time_series/2, but raises FoPost.Error.

top_posts(client, opts \\ [])

@spec top_posts(
  FoPost.Client.t(),
  keyword()
) :: {:ok, [FoPost.Analytics.TopPost.t()]} | {:error, FoPost.Error.t()}

The best performing posts in the window. sort: "recent" orders by date instead.

top_posts!(client, opts \\ [])

Same as top_posts/2, but raises FoPost.Error.