Struct clean_insights_sdk::campaign::Campaign
source · pub struct Campaign {
pub start: DateTime<Utc>,
pub end: DateTime<Utc>,
pub aggregation_period_length: u32,
pub number_of_periods: u32,
pub only_record_once: bool,
pub event_aggregation_rule: EventAggregationRule,
pub strengthen_anonymity: bool,
}
Fields§
§start: DateTime<Utc>
The start of the campaign. (inclusive)
end: DateTime<Utc>
The end of the campaign. (inclusive)
aggregation_period_length: u32
The length of the aggregation period in number of days. At the end of a period, the aggregated data will be sent to the analytics server.
number_of_periods: u32
The number of periods you want to measure in a row. Therefore the total length in days you measure
one user is aggregation_period_length * number_of_periods
beginning with the first
day of the next period after the user consented.
only_record_once: bool
Will result in recording only the first time a visit or event happened per period. Useful for yes/no questions.
event_aggregation_rule: EventAggregationRule
The rule how to aggregate the value of an event (if any given) with subsequent calls.
strengthen_anonymity: bool
Implementations§
source§impl Campaign
impl Campaign
sourcepub fn new(
start: DateTime<Utc>,
end: DateTime<Utc>,
aggregation_period_length: u32
) -> Campaign
pub fn new( start: DateTime<Utc>, end: DateTime<Utc>, aggregation_period_length: u32 ) -> Campaign
Returns a campaign with the given start
, end
and aggregation_period_length
and sane
defaults for the other properties.
Arguments
- start: The start of the campaign. (inclusive)
- end: The end of the campaign. (inclusive)
- aggregation_period_length: The length of the aggregation period in number of days. At the end of a period, the aggregated data will be sent to the analytics server.
Defaults:
- number_of_periods: 1.
- only_record_once: false.
- event_aggregation_rule: Sum.
pub fn default_number_of_periods() -> u32
pub fn default_only_record_once() -> bool
pub fn default_event_aggregation_rule() -> EventAggregationRule
pub fn default_strengthen_anonymity() -> bool
pub fn aggregation_period(&self) -> Duration
sourcepub fn current_measurement_period(
&self
) -> Option<(DateTime<Utc>, DateTime<Utc>)>
pub fn current_measurement_period( &self ) -> Option<(DateTime<Utc>, DateTime<Utc>)>
Returns the current measurement period, aka. the period where NOW is in.
If NOW is outside any possible period, because the campaign hasn’t started, yet, or already
ended, will return None
.
The first period is defined as aggregation_period_length
number of days after the start
of the campaign.