0

Request Daily Report

by
Published Oct 17, 2025

Requests a report containing daily business/advertiser metrics for a specified list of businesses over a date range. Daily metrics can be requested up to 89 days ago. Use [get_daily_reports_v3](https://docs.developer.yelp.com/reference/get_daily_reports_v3) to poll for report completion and retrieve the report.

Script yelp Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Yelp = {
3
  apiKey: string;
4
};
5
/**
6
 * Request Daily Report
7
 * Requests a report containing daily business/advertiser metrics for a specified list of businesses over a date range. Daily metrics can be requested up to 89 days ago.
8

9
Use [get_daily_reports_v3](https://docs.developer.yelp.com/reference/get_daily_reports_v3) to poll for report completion and retrieve the report.
10

11
 */
12
export async function main(
13
  auth: Yelp,
14
  body: {
15
    start: string;
16
    end: string;
17
    ids: string[];
18
    metrics:
19
      | "num_total_page_views"
20
      | "num_calls"
21
      | "num_directions_and_map_views"
22
      | "url_clicks"
23
      | "num_check_ins"
24
      | "num_user_photos"
25
      | "num_bookmarks"
26
      | "num_desktop_cta_clicks"
27
      | "num_mobile_cta_clicks"
28
      | "num_messages_to_business"
29
      | "num_mobile_page_views"
30
      | "num_desktop_search_appearances"
31
      | "num_mobile_search_appearances"
32
      | "num_desktop_page_views"
33
      | "tracking_calls"
34
      | "deals_sold"
35
      | "online_orders"
36
      | "online_bookings"
37
      | "check_in_offer_redemptions"
38
      | "collection_item_added"
39
      | "rapc_initiated"
40
      | "waitlist_visit_created"
41
      | "median_response_time_in_sec"
42
      | "reply_rate"
43
      | "organic_biz_page_views"
44
      | "organic_biz_page_views_percentage"
45
      | "rating"
46
      | "reviews"
47
      | "total_leads"
48
      | "billed_impressions"
49
      | "billed_clicks"
50
      | "ad_cost"
51
      | "ad_driven_bookmarks"
52
      | "ad_driven_calls"
53
      | "ad_driven_cta_clicks"
54
      | "ad_driven_check_ins"
55
      | "ad_driven_deals_sold"
56
      | "ad_driven_directions_and_map_views"
57
      | "ad_driven_messages_to_business"
58
      | "ad_driven_user_photos"
59
      | "ad_driven_online_reservations"
60
      | "ad_driven_url_clicks"
61
      | "ad_click_through_rate"
62
      | "average_cost_per_click"
63
      | "billable_ad_clicks"
64
      | "billable_ad_impressions"
65
      | "ad_driven_biz_page_views"
66
      | "ad_driven_calls_tracked"
67
      | "ad_driven_rapc_initiated"
68
      | "ad_driven_waitlist_visit_created"
69
      | "ad_driven_total_leads"
70
      | "ad_driven_platform_purchase_made"
71
      | "ad_driven_biz_page_views_percentage"[];
72
  },
73
) {
74
  const url = new URL(`https://api.yelp.com/v3/reporting//businesses/daily`);
75

76
  const response = await fetch(url, {
77
    method: "POST",
78
    headers: {
79
      "Content-Type": "application/json",
80
      Authorization: "Bearer " + auth.apiKey,
81
    },
82
    body: JSON.stringify(body),
83
  });
84
  if (!response.ok) {
85
    const text = await response.text();
86
    throw new Error(`${response.status} ${text}`);
87
  }
88
  return await response.json();
89
}
90