EVGCampaign Class Reference
Inherits from | NSObject |
---|---|
Declared in | EVGCampaign.h |
Overview
A custom ‘Data’ campaign to be handled by the app, served in response to Evergage actions generated by the user interacting with the app.
A campaign is delivered to a EVGCampaignHandler
registered for a unique app-defined
target
in the scope of an EVGContext
(typically a UIViewController).
See Mobile Data Campaigns Guide for
additional info, and [EVGContext setCampaignHandler:forTarget:]
for lifecycle details.
target
An app-defined string that uniquely identifies the payload data
schema - what
the data represents and its purpose. For example, “Featured Product”,
“Recommended Products”, “Info Banner”, etc.
@property (nonnull, readonly, nonatomic, copy) NSString *target
Discussion
The target is specified in the Evergage web UI when designing the campaign, and in
[EVGContext setCampaignHandler:forTarget:]
when the app defines a EVGCampaignHandler
.
To maximize flexibility, all campaigns designed for the same target should share
a compatible data
structure, in order to be consumable by any
EVGCampaignHandler
registered by the app for that specific target.
Declared In
EVGCampaign.h
campaignId
The identifier for this campaign.
@property (nonnull, readonly, nonatomic, copy) NSString *campaignId
Declared In
EVGCampaign.h
campaignName
The name of this campaign, as set in the Evergage web UI.
@property (nonnull, readonly, nonatomic, copy) NSString *campaignName
Declared In
EVGCampaign.h
experienceId
The identifier of the experience in this campaign.
@property (nonnull, readonly, nonatomic, copy) NSString *experienceId
Declared In
EVGCampaign.h
experienceName
The name of the experience in this campaign, as set in the Evergage web UI.
@property (nonnull, readonly, nonatomic, copy) NSString *experienceName
Declared In
EVGCampaign.h
messageId
The identifier of the message in this campaign.
@property (nonnull, readonly, nonatomic, copy) NSString *messageId
Declared In
EVGCampaign.h
promotedItemKeys
Array of related promoted items, if any, in minimal JSON form. Automatically used in stat tracking.
@property (nullable, readonly, nonatomic, strong) NSArray<NSDictionary<NSString*id> *> *promotedItemKeys
Declared In
EVGCampaign.h
data
This campaign’s dynamic/static JSON payload, as designed in the Evergage web UI.
@property (nonnull, readonly, nonatomic, strong) NSDictionary<NSString*id> *data
Discussion
The structure should be designed for the app-defined target
, in order to be consumable by
any EVGCampaignHandler
registered for that target.
Declared In
EVGCampaign.h
isControlGroup
If this campaign is for a user in the control group.
@property (readonly, nonatomic, assign) BOOL isControlGroup
Discussion
If NO
, this campaign should be handled normally. When applicable, show the campaign
to the user and track the impression.
If YES
, this campaign should not take effect. Do not show to the user, but do track impression IF
the campaign would have been shown.
To ensure accurate statistics, make sure to execute all the logic that could affect whether this campaign would
be shown to the user, regardless of this property. If all those checks pass and isControlGroup == NO
, show
the campaign to the user. Finally, call [EVGContext trackImpression:]
to notify Evergage that the user
saw the campaign (isControlGroup == NO
) or would have seen it (isControlGroup == YES
).
Declared In
EVGCampaign.h
– isEqual:
Indicates whether this campaign is equivalent to another campaign.
- (BOOL)isEqual:(id)object
Parameters
object |
The other campaign to compare for equality to this campaign. |
---|
Availability
1.2.1
Discussion
Typically used in EVGCampaignHandler
to avoid re-processing a campaign that’s equivalent
to one already visible/active.
The equals method checks for equivalence in the source JSON returned by the server. Campaigns are not equal if there are differences in message content.
Declared In
EVGCampaign.h
– hash
Returns a hash code value for the campaign based off of the campaign target, control group, and the ids and names of the campaign, experience, and message, but not message content.
- (NSUInteger)hash
Availability
1.2.1
Discussion
Campaigns with different message content (due to campaign edits or dynamic message
content) currently return the same hashcode. Use isEqual:
to determine full equivalence or not.
Declared In
EVGCampaign.h