roam/aweber/20210915133101-analytics_view_service.org
2021-12-01 17:28:09 -05:00

12 KiB

Analytics View Service

The Analytics View Service provides a collection of report endpoints. These endpoints handle querying the analytics databases or, in the longer term, exposing efficient materialized data views.

Plan

Parent ticket
CCPANEL-11781
ITEM Effort
Plan 19d 4:00
Create the analytics view service 2d
Create the analytics view service playbook 4h
Plan API structure
Create endpoints for existing reports 17d 0:00
Opens 1d
Clicks 1d
Sales 1d
Sales Totals 1d
Sale Currencies 1d
Sale Events 1d
Lifetime Sales 1d
Pending Broadcasts 1d
Completed Broadcasts 1d
Cities, States, and Countries 1d
Followups 1d
New Subscribers Daily 1d
New Subscribers Weekly 1d
New Subscribers Monthly 1d
Subscriber Totals Daily 1d
Subscriber Totals Weekly 1d
Subscriber Totals Monthly 1d
Migrate reports to the Analytics View Service

Create the analytics view service

  • New project using cookie cutter
  • Deployed to kubernetes
  • Grafana dashboard created

Create the analytics view service playbook

Plan API structure

  • Pathing (/reports/*)?
  • Report versioning? (/reports/{name}.v{version})?

Create endpoints for existing reports

Opens over time

Name
daily-opens
Parameters
  • List (default: all lists)
  • Date range (default: last 30 days)
Report API controller endpoints
  • opens_all_range
  • opens_list_range
  {
    "2021-11-02T00:00:00Z": {
      "broadcasts": 2499,
      "followups": 2547,
      "unique": 2923,
      "total": 5046
    },
    "2021-11-03T00:00:00Z": {
      "broadcasts": 25808,
      "followups": 2430,
      "unique": 24876,
      "total": 28238
    },
    "2021-11-04T00:00:00Z": {
      "broadcasts": 16733,
      "followups": 1437,
      "unique": 14780,
      "total": 18170
    }
  }
Sample response

Clicks over time

Name
daily-clicks
Parameters
  • List (default: all lists)
  • Date range (default: last 30 days)
Report API controller endpoints
  • clicks_all_range
  • clicks_list_range
  {
    "2021-11-02T00:00:00Z": {
      "broadcasts": 105,
      "followups": 137,
      "unique": 130,
      "total": 242
    },
    "2021-11-03T00:00:00Z": {
      "broadcasts": 636,
      "followups": 185,
      "unique": 622,
      "total": 821
    },
    "2021-11-04T00:00:00Z": {
      "broadcasts": 480,
      "followups": 109,
      "unique": 426,
      "total": 589
    }
  }
Sample response

Sales over time (events)

Name
sale-events
Parameters
  • Date range (default: last 30 days)
  • Currency (default: USD)
Report API controller endpoints
  • sales_tracked_events
  [
    {
      "time": "2021-11-02 09:37:36-04",
      "type": "followup",
      "currency": "USD",
      "revenue": "19.00",
      "note": "",
      "description": "Upgraded to Pro",
      "source_url": "https://www.aweber.com/users/#upgraded",
      "email": "team@harmoniamedia.com"
    },
    {
      "time": "2021-11-02 09:37:37-04",
      "type": "followup",
      "currency": "USD",
      "revenue": "19.00",
      "note": "",
      "description": "Upgraded to Pro",
      "source_url": "https://www.aweber.com/users/#upgraded",
      "email": "team@harmoniamedia.com"
    },
    {
      "time": "2021-11-02 12:01:17-04",
      "type": "followup",
      "currency": "USD",
      "revenue": "19.00",
      "note": "",
      "description": "Upgraded to Pro",
      "source_url": "https://www.aweber.com/users/#upgraded",
      "email": "giuliagiardino12@gmail.com"
    },
    {
      "time": "2021-11-02 12:01:19-04",
      "type": "followup",
      "currency": "USD",
      "revenue": "19.00",
      "note": "",
      "description": "Upgraded to Pro",
      "source_url": "https://www.aweber.com/users/#upgraded",
      "email": "giuliagiardino12@gmail.com"
    },
    {
      "time": "2021-11-04 05:21:35-04",
      "type": "broadcast",
      "currency": "USD",
      "revenue": "19.00",
      "note": "",
      "description": "Upgraded to Pro",
      "source_url": "https://www.aweber.com/users/#upgraded",
      "email": "jeremy@jeremy-quick.com"
    },
    {
      "time": "2021-11-04 05:21:36-04",
      "type": "broadcast",
      "currency": "USD",
      "revenue": "19.00",
      "note": "",
      "description": "Upgraded to Pro",
      "source_url": "https://www.aweber.com/users/#upgraded",
      "email": "jeremy@jeremy-quick.com"
    }
  ]
Sample response

Sales over time (summary)

Name
daily-sales
Parameters
  • Date range (default: last 60 days)
  • Currency (default: USD)
  {
    "2021-11-02T00:00:00Z": {
      "broadcast": 0,
      "followup": 76,
      "pageview": 76,
      "ecommerce": 0,
      "total": 76
    },
    "2021-11-03T00:00:00Z": {
      "broadcast": 0,
      "followup": 0,
      "pageview": 0,
      "ecommerce": 0,
      "total": 0
    },
    "2021-11-04T00:00:00Z": {
      "broadcast": 38,
      "followup": 0,
      "pageview": 38,
      "ecommerce": 0,
      "total": 38
    }
  }
Sample response

Lifetime Sale Totals

Name
sale-totals
Parameters
  • Currency (default: USD)
Report API controller endpoints
  • sales_tracked_total
  {
    "count": 94924,
    "pagehits": 1820122.79,
    "revenue": 2181498.96
  }
Sample response

Sale Currencies

Name
sale-currencies
Parameters
  • Date range (default: last 60 days)
Report API controller endpoints
  • sales_tracked_currencies
["USD", "CAD"]
Sample response

Pending Broadcasts

Name
pending-broadcasts
Parameters
  • List (default: all lists)
Report API controller endpoints
  • broadcasts_pending
  [
    {
      "unit_id": "3854",
      "send_date": "01/01/25 12:00am",
      "broadcast_id": "1800243",
      "subject": "Scheduled Broadcast Test",
      "status": "Queue",
      "percent_done": "0",
      "mesg_encoding": "utf-8",
      "campaign_id": "1802217",
      "unit": "awlist3854",
      "orig_send_date": "2025-01-01 00:00:00-05",
      "friendly_list_name": "Fluff Cafe",
      "id": "1802217",
      "list_id": "3854",
      "account_id": "778",
      "campaign_type_id": "b",
      "uses_block_editor": "t"
    }
  ]
Sample response

Completed Broadcasts

Name
completed-broadcasts
Parameters
  • List (default: all lists)
Report API controller endpoints
  • broadcasts_completed
  • broadcasts_completed_all
  [
    {
      "a_id": "778",
      "broadcast_id": "1258855",
      "for_sent_date": "08/14/20 03:41 PM",
      "track_click_rate": "1",
      "unit_id": "3854",
      "assassin_pts": "0",
      "mesg_type": "HTML",
      "mesg_encoding": "utf-8",
      "sent_date": "2020-08-14 15:41:05.24086-04",
      "num_emailed": "1",
      "num_undeliv": 0,
      "num_opened": 0,
      "num_attachments": 0,
      "num_complaints": 0,
      "subject": "Testing a bad segment",
      "created_date": "2020-08-14 15:38:57.59072-04",
      "status": "Sent Composer",
      "lead_view_id": "42564",
      "unit": "awlist3854",
      "pct_opened": "0",
      "show_opens_warning": true,
      "pct_undeliv": "0",
      "total_clicks": 0,
      "clicks_analytics_type": "premium",
      "pct_click": "0",
      "pct_complaints": "0",
      "segment_id": "42564",
      "extra_lists": "",
      "excluded_lists": "",
      "extra_lists_count": 0,
      "excluded_lists_count": 0,
      "friendly_list_name": "Fluff Cafe"
    },
    {
      "a_id": "778",
      "broadcast_id": "1243650",
      "for_sent_date": "08/05/20 06:33 PM",
      "track_click_rate": "1",
      "unit_id": "3854",
      "assassin_pts": "0",
      "mesg_type": "Text/HTML",
      "mesg_encoding": "utf-8",
      "sent_date": "2020-08-05 18:33:48.638875-04",
      "num_emailed": "27",
      "num_undeliv": 0,
      "num_opened": 0,
      "num_attachments": 0,
      "num_complaints": 0,
      "subject": "Buggssss 🐛🐛🐛🐛🐛🐛🐛",
      "created_date": "2020-08-05 18:31:10.567418-04",
      "status": "Sent Composer",
      "lead_view_id": "8",
      "unit": "awlist3854",
      "pct_opened": "0",
      "show_opens_warning": true,
      "pct_undeliv": "0",
      "total_clicks": 0,
      "clicks_analytics_type": "premium",
      "pct_click": "0",
      "pct_complaints": "0",
      "segment_id": "8",
      "extra_lists": "",
      "excluded_lists": "",
      "extra_lists_count": 0,
      "excluded_lists_count": 0,
      "friendly_list_name": "Fluff Cafe"
    }
  ]
Sample response

Cities, States, and Countries

Name
subscribers-by-location
Parameters
  • List (default: all lists)
Report API controller endpoints
  • city_state_countries
  [
    {
      "country": null,
      "state": null,
      "city": null,
      "pending": 0,
      "unsubscribed": 457262,
      "subscribed": 276245,
      "total": 733507
    },
    {
      "country": "US",
      "state": "PA",
      "city": "Newtown",
      "pending": 0,
      "unsubscribed": 279304,
      "subscribed": 3236,
      "total": 282540
    },
    {
      "country": "US",
      "state": null,
      "city": null,
      "pending": 0,
      "unsubscribed": 109074,
      "subscribed": 2456,
      "total": 111530
    },
    {
      "country": "US",
      "state": "PA",
      "city": "Philadelphia",
      "pending": 0,
      "unsubscribed": 48485,
      "subscribed": 657,
      "total": 49142
    },
    {
      "country": "US",
      "state": "PA",
      "city": "Huntingdon Valley",
      "pending": 0,
      "unsubscribed": 4839,
      "subscribed": 90,
      "total": 4929
    },
    {
      "country": "VN",
      "state": "64",
      "city": "Hanoi",
      "pending": 0,
      "unsubscribed": 204,
      "subscribed": 2,
      "total": 206
    },
    {
      "country": "VN",
      "state": "65",
      "city": "Ho Chi Minh City",
      "pending": 0,
      "unsubscribed": 176,
      "subscribed": 1,
      "total": 177
    }
  ]
Sample response

Followups

New Subscribers Daily

New Subscribers Weekly

New Subscribers Monthly

Subscriber Totals Daily

Subscriber Totals Weekly

Subscriber Totals Monthly

Migrate reports to the Analytics View Service