Interface Campaign

A custom “Data” campaign to be handled by the app, served in response to Marketing Cloud Personalization actions generated by the user interacting with the app.

1public interface Campaign

A campaign is delivered to a CampaignHandler registered for a unique app-defined target in the scope of a Context (typically an Activity’s Screen via Evergage.getScreenForActivity(Activity)).

For additional information, see Mobile Data Campaigns. For lifecycle details, see Context.setCampaignHandler(com.evergage.android.CampaignHandler, java.lang.String).

Methods 

MethodsDescriptionModifier and Type
equals(java.lang.Object)Indicates whether this campaign is equivalent to another campaign.boolean
getCampaignId()The identifier for this campaign.java.lang.String
getCampaignName()The name of this campaign, as set in the Personalization UI.java.lang.String
getData()This campaign’s dynamic/static JSON payload, as designed in the Personalization UI.org.json.JSONObject
getExperienceId()The identifier of the experience in this campaign.java.lang.String
getExperienceName()The name of the experience in this campaign, as set in the Personalization UI.java.lang.String
getMessageId()The identifier of the message in this campaign.java.lang.String
getPromotedItemKeys()Array of related promoted items, if any, in minimal JSON form.org.json.JSONArray
getTarget()An app-defined string that uniquely identifies the payload data schema - what the data represents and its purpose.java.lang.String
hashCode()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.int
isControlGroup()If this campaign is for a user in the control group.boolean

getTarget 

1java.lang.String getTarget()

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.

The target is specified in the Personalization UI when designing the campaign, and in Context.setCampaignHandler(com.evergage.android.CampaignHandler, java.lang.String) when the app defines a CampaignHandler.

To maximize flexibility, all campaigns designed for the same target should share a compatible data structure, in order to be consumable by any CampaignHandler registered by the app for that specific target.

See Also

getCampaignId 

1java.lang.String getCampaignId()

The identifier for this campaign.

getCampaignName 

1java.lang.String getCampaignName()

The name of this campaign, as set in the Personalization UI.

getExperienceId 

1java.lang.String getExperienceId()

The identifier of the experience in this campaign.

getExperienceName 

1java.lang.String getExperienceName()

The name of the experience in this campaign, as set in the Personalization UI.

getMessageId 

1java.lang.String getMessageId()

The identifier of the message in this campaign.

getPromotedItemKeys 

1org.json.JSONArray getPromotedItemKeys()

Array of related promoted items, if any, in minimal JSON form. Automatically used in stat tracking.

getData 

1org.json.JSONObject getData()

This campaign’s dynamic/static JSON payload, as designed in the Personalization UI. The structure should be designed for the app-defined target, in order to be consumable by any CampaignHandler registered for that target.

See Also

isControlGroup 

1boolean isControlGroup()

If this campaign is for a user in the control group. If false, this campaign should be handled normally. When applicable, show the campaign to the user and track the impression.

If true, this campaign should not take effect. Do not show to the user, but do still track impressions IF the campaign would have been shown.

To ensure accurate statistics, make sure to execute all the logic that could affect whether the campaign should be shown to the user, regardless of this property. If all those checks pass and isControlGroup == false, show the campaign to the user. Finally, call Context.trackImpression(com.evergage.android.Campaign) to notify Personalization that the user saw the campaign (isControlGroup == false) or would have seen it (isControlGroup == true).

equals 

1boolean equals(java.lang.Object o)

Indicates whether this campaign is equivalent to another campaign. Typically used in CampaignHandler 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.

Overrides

equals in class java.lang.Object

hashCode() 

1int hashCode()

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.

Campaigns with different message content (due to campaign edits or dynamic message content) currently return the same hashcode. Use equals(java.lang.Object) to determine full equivalence or not.

Overrides

hashCode in class java.lang.Object