Outcomes

An Outcome is the measurable target of a Growth Play. An Outcome can have a target value for a period, linked campaigns, and a conversion measurement. The conversion measurement defines which event counts as a conversion, and where the value of the conversion comes from.

The functions on this page only read Outcomes. They do not create, change, or delete an Outcome. Each function needs the Growth Plays permission (MANAGE_GROWTH_PLAYS).

Retrieving Outcome objects

class OutcomeMixin

This class defines all functions related to BlueConic Outcomes. The functions only read Outcomes. They need the Growth Plays permission (MANAGE_GROWTH_PLAYS).

get_outcome(outcome_id)

Gets the Outcome with the Outcome ID and returns it as a BlueConic Outcome.

Parameters:

outcome_id (str) – The ID of the Outcome

Raises:

HTTPError: Request fails

Returns:

Outcome

Return type:

Outcome

Usage:
>>> import blueconic
>>> bc = blueconic.Client()
>>> outcome = bc.get_outcome('5ba0f0e9-0a1f-4d1d-8d4c-1c5b6fd7b9b3')
>>> print(outcome.name)
Subscriptions in Q4
get_outcomes(start=0, count=10000000)

Gets all Outcomes and returns them in a generator with all BlueConic Outcomes.

Parameters:
  • start (int, optional) – The Outcome to start from. Defaults to 0.

  • count (int, optional) – The number of Outcomes to retrieve. Defaults to 10000000.

Returns:

Iterator with Outcome

Return type:

Iterator[Outcome]

Usage:
>>> import blueconic
>>> bc = blueconic.Client()
>>> for outcome in bc.get_outcomes():
>>>     print(outcome.name, outcome.target_value, outcome.target_period)
Subscriptions in Q4 50000.0 QUARTER

Using Outcome objects

class Outcome

This class represents a BlueConic Outcome. An Outcome is the measurable target of a Growth Play. It has an optional target value for a period, the campaigns that are linked to it, and a conversion measurement.

property campaign_ids

Returns the IDs of the campaigns that are linked to this Outcome.

Returns:

The campaign IDs. The list is empty when no campaign is linked.

Return type:

Sequence[str]

property creation_date
Returns:

The creation date of this object.

Return type:

Optional[datetime]

property creator_username
Returns:

The username that created this object.

Return type:

Optional[str]

property description
Returns:

Description of this object.

Return type:

Optional[str]

property id
Returns:

ID of this object.

Return type:

str

property labels
Returns:

The labels this object.

Return type:

Optional[Sequence[str]

property last_modified_date
Returns:

The last modified date of this object.

Return type:

Optional[datetime]

property last_modified_username
Returns:

The last modified username of this object.

Return type:

Optional[str]

property measurement

Returns the conversion measurement of this Outcome. The conversion measurement defines which event counts as a conversion, and where the value of the conversion comes from.

None means that the Outcome uses the template default of its Growth Play. For the Growth Play templates that BlueConic measures, the template default is the order event, with the value from the event field total_revenue. An Outcome of a Growth Play without a template measurement is then not measured.

Returns:

The conversion measurement, or None when the Outcome uses the template default.

Return type:

Optional[OutcomeMeasurement]

Usage:
>>> import blueconic
>>> bc = blueconic.Client()
>>> outcome = bc.get_outcome('5ba0f0e9-0a1f-4d1d-8d4c-1c5b6fd7b9b3')
>>> if outcome.measurement is None:
>>>     print("The Outcome uses the template default.")
>>> else:
>>>     print(outcome.measurement.event_type_id)
subscription
property name
Returns:

Name of this object.

Return type:

Optional[str]

property target_period

Returns the period of the target value of this Outcome.

Returns:

MONTH or QUARTER, or None when the Outcome has no target period.

Return type:

Optional[str]

property target_value

Returns the target value of this Outcome.

Returns:

The target value, or None when the Outcome has no target value.

Return type:

Optional[float]

Usage:
>>> import blueconic
>>> bc = blueconic.Client()
>>> outcome = bc.get_outcome('5ba0f0e9-0a1f-4d1d-8d4c-1c5b6fd7b9b3')
>>> outcome.target_value
50000.0

Using conversion measurement objects

The property measurement of an Outcome is None when the Outcome has no conversion measurement of its own. The Outcome then uses the template default of its Growth Play. For the Growth Play templates that BlueConic measures, the template default is the order event, with the value from the event field total_revenue. An Outcome of a Growth Play without a template measurement is then not measured.

Usage:
>>> import blueconic
>>> bc = blueconic.Client()
>>> for outcome in bc.get_outcomes():
>>>     if outcome.measurement is None:
>>>         print(outcome.name, "uses the template default")
>>>     else:
>>>         print(outcome.name, "counts", outcome.measurement.event_type_id, "events")
Subscriptions in Q4 counts subscription events
Repeat purchases uses the template default
class OutcomeMeasurement

This class represents the conversion measurement of an Outcome. It defines which timeline event counts as a conversion, which conditions the event must meet, and where the value of the conversion comes from.

property conditions
Returns:

The conditions that an event must all meet to count as a conversion. The list is empty when every event of the event type counts.

Return type:

Sequence[OutcomeConversionCondition]

property event_type_id
Returns:

The ID of the timeline event type of the conversion.

Return type:

Optional[str]

property value
Returns:

The source of the value of the conversion.

Return type:

Optional[OutcomeConversionValue]

class OutcomeConversionCondition

This class represents one condition of the conversion measurement of an Outcome. An event counts as a conversion only when it meets all the conditions of the measurement.

property operator

The test to run on the event field. The values are:

  • HAS_A_VALUE: The event field has at least one value that is not blank.

  • CONTAINS_ANY: At least one value of the event field is equal to one of the values of the condition. The comparison ignores the case.

  • GREATER_THAN: At least one value of the event field is a number that is greater than the one value of the condition.

  • LESS_THAN: At least one value of the event field is a number that is less than the one value of the condition.

  • EQUALS: At least one value of the event field is a number that is equal to the one value of the condition.

A later version of BlueConic can add operators. The value stays a string, so that a new operator does not stop the code.

Returns:

The name of the operator.

Return type:

Optional[str]

property property_id
Returns:

The ID of the event field to test.

Return type:

Optional[str]

property values
Returns:

The values to compare with. The list is empty for HAS_A_VALUE.

Return type:

Sequence[str]

class OutcomeConversionValue

This class represents the source of the value of a conversion. It is part of the conversion measurement of an Outcome.

property fixed_value
Returns:

The value of each conversion, for the type FIXED. Otherwise None.

Return type:

Optional[float]

property property_id
Returns:

The ID of the event field or profile property that holds the value, for the types EVENT_PROPERTY and PROFILE_PROPERTY. Otherwise None.

Return type:

Optional[str]

property type

The kind of source of the value. The values are:

  • NONE: The conversion has no value. The report counts conversions only.

  • FIXED: Each conversion has the same value, fixed_value.

  • EVENT_PROPERTY: The value is the number in the event field property_id.

  • PROFILE_PROPERTY: The value is the number in the profile property property_id of the profile that made the conversion.

A later version of BlueConic can add types. The value stays a string, so that a new type does not stop the code.

Returns:

The name of the type.

Return type:

Optional[str]