1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/*
* Hanzo Cloud API
*
* The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
*
* The version of the OpenAPI document: v1
*
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct CampaignResults {
#[serde(rename = "abTest", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
pub ab_test: Option<Option<serde_json::Value>>,
/// Available is false when the analytics warehouse is not connected or the query failed: the funnel below is then zero because nothing could be read, not because nothing happened. Spend and Channels are still real — they come from the connectors, not the warehouse.
#[serde(rename = "available", skip_serializing_if = "Option::is_none")]
pub available: Option<bool>,
/// CAC is customer acquisition cost: spend DOLLARS per conversion, rounded to cents. 0 when nothing converted — that is \"not yet computable\", not \"free\".
#[serde(rename = "cac", skip_serializing_if = "Option::is_none")]
pub cac: Option<f64>,
/// CampaignID is the campaign these results are for, echoed from the request.
#[serde(rename = "campaignId", skip_serializing_if = "Option::is_none")]
pub campaign_id: Option<String>,
/// Channels is the per-channel spend breakdown that SpendCents sums, one row per channel on the campaign including the ones that never launched.
#[serde(rename = "channels", skip_serializing_if = "Option::is_none")]
pub channels: Option<Vec<models::ChannelMetric>>,
/// Clicks is the campaign's click events over the window.
#[serde(rename = "clicks", skip_serializing_if = "Option::is_none")]
pub clicks: Option<i32>,
/// Conversions is the terminal funnel events attributed to the campaign — orders completed, signups completed, explicit conversion events.
#[serde(rename = "conversions", skip_serializing_if = "Option::is_none")]
pub conversions: Option<i32>,
/// CTR is clicks per impression, a fraction rounded to 4 places (0.0123 = 1.23%), not a percentage. 0 when there were no impressions to divide by.
#[serde(rename = "ctr", skip_serializing_if = "Option::is_none")]
pub ctr: Option<f64>,
/// CVR is conversions per click, a fraction rounded to 4 places. 0 when there were no clicks.
#[serde(rename = "cvr", skip_serializing_if = "Option::is_none")]
pub cvr: Option<f64>,
/// End is the window's end, RFC3339 UTC — the read's own clock unless an explicit pair was given. The window is a LOOKBACK, not the campaign's own lifetime.
#[serde(rename = "end", skip_serializing_if = "Option::is_none")]
pub end: Option<String>,
/// Impressions is how many times the campaign's creatives were shown, counted from its utm_campaign-tagged impression events.
#[serde(rename = "impressions", skip_serializing_if = "Option::is_none")]
pub impressions: Option<i32>,
/// Name is the campaign's display name at read time, so a result can be labelled without a second fetch.
#[serde(rename = "name", skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
/// Range is the window actually used: 24h, 7d, 30d, 90d, or \"custom\" when an explicit start/end pair was honored. An unparseable or absent range reads 30d, so this is the value to trust, not the one that was sent.
#[serde(rename = "range", skip_serializing_if = "Option::is_none")]
pub range: Option<String>,
/// Revenue is the summed revenue attribute of the campaign's events, in whole CURRENCY UNITS (dollars) — the one money value here that is not in cents.
#[serde(rename = "revenue", skip_serializing_if = "Option::is_none")]
pub revenue: Option<f64>,
/// ROAS is return on ad spend: revenue per spend DOLLAR, rounded to 2 places (2.5 = $2.50 back per $1). 0 when nothing was spent.
#[serde(rename = "roas", skip_serializing_if = "Option::is_none")]
pub roas: Option<f64>,
/// Source names the analytics table the funnel was read from, so an operator can see exactly what was counted. Set even when Available is false.
#[serde(rename = "source", skip_serializing_if = "Option::is_none")]
pub source: Option<String>,
/// SpendCents is the campaign's total spend in CENTS: the sum of what each live channel's provider reports. A channel whose spend could not be read contributes 0 and says so on its own row.
#[serde(rename = "spendCents", skip_serializing_if = "Option::is_none")]
pub spend_cents: Option<i32>,
/// Start is the window's inclusive start, RFC3339 UTC.
#[serde(rename = "start", skip_serializing_if = "Option::is_none")]
pub start: Option<String>,
/// Status is the campaign's lifecycle state at read time — draft, live, paused, completed or failed. A draft has never run, so its funnel is legitimately zero.
#[serde(rename = "status", skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
/// Visitors is how many distinct people the campaign reached, counted by event identity across ALL its events in the window — not a subset of Impressions, so it can exceed them for a campaign whose provider reports clicks but not views.
#[serde(rename = "visitors", skip_serializing_if = "Option::is_none")]
pub visitors: Option<i32>,
}
impl CampaignResults {
pub fn new() -> CampaignResults {
CampaignResults {
ab_test: None,
available: None,
cac: None,
campaign_id: None,
channels: None,
clicks: None,
conversions: None,
ctr: None,
cvr: None,
end: None,
impressions: None,
name: None,
range: None,
revenue: None,
roas: None,
source: None,
spend_cents: None,
start: None,
status: None,
visitors: None,
}
}
}