GoodAnalytics (GoodAnalytics v0.1.1)

Copy Markdown View Source

Visitor intelligence, link tracking, source attribution, and behavioral analytics for Phoenix.

GoodAnalytics is a pluggable Elixir/Phoenix library that adds visitor intelligence, link tracking, source attribution, and behavioral analytics to any existing Phoenix application.

Configuration

config :good_analytics,
  repo: MyApp.Repo,
  links: [domains: ["mybrand.link"]]

Summary

Functions

Archive a link.

Archive a partner, scoped to a workspace.

Create a tracked short link.

Create a referral partner.

Returns the sentinel workspace UUID for single-tenant library mode.

Remove all PII, events, and identity signals for a visitor (GDPR).

Get an active partner by key and workspace.

Get a link by ID.

Get a link by domain and key.

Get a partner by ID, scoped to a workspace.

Get a visitor by ID.

Get a visitor by host-app external ID.

Associate a visitor with the host app's known person attributes.

Get the most recent event of a given type for a visitor.

Get click events for a link.

Get aggregated stats for a link.

List recent events for a workspace.

List links for a workspace.

List partners for a workspace.

List recent visitors for a workspace.

Register a callback for an event type.

Resolve tracking signals to a single visitor record.

Returns the PostgreSQL schema name used by GoodAnalytics tables.

Generate social share URLs for a short link.

Get source platform/medium breakdown for a workspace.

Update a link.

Update a partner, scoped to a workspace.

Update visitor attribution (extension point for GoodPartners).

Update visitor lifecycle status.

Get the attribution path for a visitor.

Get the full event timeline for a visitor.

Functions

archive_link(id)

Archive a link.

archive_partner(workspace_id, id)

Archive a partner, scoped to a workspace.

create_link(attrs)

Create a tracked short link.

create_partner(attrs)

Create a referral partner.

default_workspace_id()

@spec default_workspace_id() :: String.t()

Returns the sentinel workspace UUID for single-tenant library mode.

forget_visitor(visitor_id)

Remove all PII, events, and identity signals for a visitor (GDPR).

get_active_partner_by_key(workspace_id, key)

Get an active partner by key and workspace.

get_link(id)

Get a link by ID.

get_partner(workspace_id, id)

Get a partner by ID, scoped to a workspace.

get_visitor(id)

Get a visitor by ID.

get_visitor_by_external_id(workspace_id, person_external_id)

Get a visitor by host-app external ID.

identify(visitor, person_attrs)

Associate a visitor with the host app's known person attributes.

last_event(visitor_id, event_type)

Get the most recent event of a given type for a visitor.

list_events(workspace_id, opts \\ [])

List recent events for a workspace.

list_links(workspace_id, opts \\ [])

List links for a workspace.

list_partners(workspace_id, opts \\ [])

List partners for a workspace.

list_visitors(workspace_id, opts \\ [])

List recent visitors for a workspace.

register_hook(event_type, callback, opts \\ [])

Register a callback for an event type.

Pass async: true to register a slow, side-effecting hook that runs fire-and-forget off the sync redirect budget (see GoodAnalytics.Hooks).

resolve_visitor(signals, opts \\ [])

Resolve tracking signals to a single visitor record.

schema_name()

Returns the PostgreSQL schema name used by GoodAnalytics tables.

share_urls(short_link, opts \\ [])

Generate social share URLs for a short link.

source_breakdown(workspace_id, opts \\ [])

Get source platform/medium breakdown for a workspace.

track(visitor, event_type, properties \\ %{})

Record a tracking event.

track_lead(visitor, person_attrs, opts \\ [])

Track a lead (signup).

Accepts an optional keyword list as the third argument:

  • :connector_signals — explicit connector signal overrides

track_sale(visitor, sale_attrs, opts \\ [])

Track a sale.

Accepts an optional keyword list as the third argument:

  • :connector_signals — explicit connector signal overrides

update_link(id, attrs)

Update a link.

update_partner(workspace_id, id, attrs)

Update a partner, scoped to a workspace.

update_visitor_attribution(visitor_id, attrs)

Update visitor attribution (extension point for GoodPartners).

update_visitor_status(visitor_id, status)

Update visitor lifecycle status.

visitor_attribution(visitor_id)

Get the attribution path for a visitor.

visitor_timeline(visitor_id)

Get the full event timeline for a visitor.