:PROPERTIES: :ID: c45881de-46f2-4f76-9579-063626c5956c :END: #+title: 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 :: [[https://jira.aweber.io/browse/CCPANEL-11781][CCPANEL-11781]] :PROPERTIES: :COLUMNS: %40ITEM %Effort{:} :END: #+BEGIN: columnview :id local | 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 | | #+END: ** Create the analytics view service :PROPERTIES: :Effort: 2d :END: - New project using cookie cutter - Deployed to kubernetes - Grafana dashboard created ** Create the analytics view service playbook :PROPERTIES: :Effort: 4h :END: ** Plan API structure - Pathing (=/reports/*=)? - Report versioning? (=/reports/{name}.v{version}=)? ** Create endpoints for existing reports - Based on the endpoints provided in the [[id:3ddc4e32-932f-4748-bfe9-7025d4d6b352][Report API Controller]] - Are all of these report endpoints in use? *** Opens over time :PROPERTIES: :Effort: 1d :END: #+attr_confluence: :as-table t - Name :: daily-opens - Parameters :: - List (default: all lists) - Date range (default: last 30 days) - Report API controller endpoints :: - opens_all_range - opens_list_range #+caption: Sample response #+begin_src json { "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 } } #+end_src *** Clicks over time :PROPERTIES: :Effort: 1d :END: #+attr_confluence: :as-table t - Name :: daily-clicks - Parameters :: - List (default: all lists) - Date range (default: last 30 days) - Report API controller endpoints :: - clicks_all_range - clicks_list_range #+caption: Sample response #+begin_src json { "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 } } #+end_src *** Sales over time (events) :PROPERTIES: :Effort: 1d :END: #+attr_confluence: :as-table t - Name :: sale-events - Parameters :: - Date range (default: last 30 days) - Currency (default: USD) - Report API controller endpoints :: - sales_tracked_events #+caption: Sample response #+begin_src json [ { "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" } ] #+end_src *** Sales over time (summary) :PROPERTIES: :Effort: 1d :END: #+attr_confluence: :as-table t - Name :: daily-sales - Parameters :: - Date range (default: last 60 days) - Currency (default: USD) #+caption: Sample response #+begin_src json { "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 } } #+end_src *** Lifetime Sale Totals #+attr_confluence: :as-table t - Name :: sale-totals - Parameters :: - Currency (default: USD) - Report API controller endpoints :: - sales_tracked_total #+caption: Sample response #+begin_src json { "count": 94924, "pagehits": 1820122.79, "revenue": 2181498.96 } #+end_src *** Sale Currencies :PROPERTIES: :Effort: 1d :END: #+attr_confluence: :as-table t - Name :: sale-currencies - Parameters :: - Date range (default: last 60 days) - Report API controller endpoints :: - sales_tracked_currencies #+caption: Sample response #+begin_src json ["USD", "CAD"] #+end_src *** Pending Broadcasts :PROPERTIES: :Effort: 1d :END: #+attr_confluence: :as-table t - Name :: pending-broadcasts - Parameters :: - List (default: all lists) - Report API controller endpoints :: - broadcasts_pending #+caption: Sample response #+begin_src json [ { "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" } ] #+end_src *** Completed Broadcasts :PROPERTIES: :Effort: 1d :END: #+attr_confluence: :as-table t - Name :: completed-broadcasts - Parameters :: - List (default: all lists) - Report API controller endpoints :: - broadcasts_completed - broadcasts_completed_all #+caption: Sample response #+begin_src json [ { "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" } ] #+end_src *** Cities, States, and Countries :PROPERTIES: :Effort: 1d :END: #+attr_confluence: :as-table t - Name :: subscribers-by-location - Parameters :: - List (default: all lists) - Report API controller endpoints :: - city_state_countries #+caption: Sample response #+begin_src json [ { "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 } ] #+end_src *** Followups :PROPERTIES: :Effort: 1d :END: *** New Subscribers Daily :PROPERTIES: :Effort: 1d :END: *** New Subscribers Weekly :PROPERTIES: :Effort: 1d :END: *** New Subscribers Monthly :PROPERTIES: :Effort: 1d :END: *** Subscriber Totals Daily :PROPERTIES: :Effort: 1d :END: *** Subscriber Totals Weekly :PROPERTIES: :Effort: 1d :END: *** Subscriber Totals Monthly :PROPERTIES: :Effort: 1d :END: ** Migrate reports to the Analytics View Service