Campaign

class cleaninsights.campaign.Campaign(start: datetime.date, end: datetime.date, aggregation_period_length: datetime.timedelta, number_of_periods: Optional[int], only_record_once: bool, event_aggregation_rule: cleaninsights.aggregation_rule.EventAggregationRule)

A logical grouping for event and visit measurements. This grouping is user-defined and can be bounded by time and with specific measurement properties.

aggregation_period(dt: datetime.datetime)Optional[cleaninsights.aggregation_period.AggregationPeriod]

The aggregation period for this campaign in which dt falls. The period defines start (inclusive) and end (exclusive) dates. If it is currently before or after the campaign’s start or end dates, None will be returned.

aggregation_period_length: datetime.timedelta

The length of each aggregation period. In “real-time” mode, aggregated data will be sent to the analytics server at the end of each aggregation period.

property current_aggregation_period

The current aggregation period for this campaign. The period defines start (inclusive) and end (exclusive) dates. If it is currently before or after the campaign’s start or end dates, None will be returned.

property current_measurement_period

Alias for Campaign.current_aggregation_period. Deprecated. This name is used in the TypeScript and iOS SDKs, however is not consistent with usage in the Campaign object.

end: datetime.date

The end date for this campaign. Measurements to be recorded before this date will be ignored.

event_aggregation_rule: cleaninsights.aggregation_rule.EventAggregationRule

The aggregation rule to be used when recording measurements.

classmethod from_dict(campaign_data: Dict[str, Any])
number_of_periods: Optional[int]

The number of periods for which to collect measurements from each user. If None there will be no restriction and measurements will continue until the end.

only_record_once: bool

The event should only be recorded once, it either happened zero times or more than zero times within a single aggregation period.

start: datetime.date

The start date for this campaign. Measurements to be recorded before this date will be ignored.