swellAPI.getActiveCampaigns()

This method returns an array containing all active campaigns you are running as well as the logged in customer’s status toward each one. You can use this method to build custom interface around your campaigns.

$(document).on("swell:setup", function(){
    var activeCampaigns = swellAPI.getActiveCampaigns();

    activeCampaigns.forEach(function(campaign){
      // render each campaign
    });
  })
backgroundImageUrl: "https://paperclip-cloudfront.swellrewards.com/images/images/4870_1530799978.original.png?1530799978"
campaignTiers: []
ctaText: "Take me there"
customerActionsCompleted: 0
customerCanParticipate: true
customerCompleted: false
customerCompletions: 0
customerDaysUntilNextAction: undefined
customerDaysUntilNextParticipation: undefined
customerDaysUntilNextReward: undefined
customerHoursUntilNextAction: undefined
customerHoursUntilNextParticipation: undefined
customerHoursUntilNextReward: undefined
customerMinutesUntilNextAction: 0
customerMinutesUntilNextParticipation: 0
customerMinutesUntilNextReward: 0
details: "Give your friend $15 off their first purchase of $100+ and get $15 in Drops."
expiresAt: null
icon: "fa-heart"
id: 377555
rewardPercentage: 10
rewardPoints: 300
rewardText: "15"
rewardType: "fixed_amount"
title: "Refer a friend"
__proto__: Object

Campaign Object

AttributeTypeDescription
idintThe campaign id, useful for setting up click handlers or triggering custom actions
ctaTextstringThe call to action button text set in Swell admin
detailsstringThe description of the campaign set in the Swell admin
titlestringThe one line description of the campaign set in Swell admin
expiresAtdatetimeCampaign expiration if campaign is running for limited time
iconstringThe Font Awesome icon class (or image url) set for this campaign
rewardTextstringDescription of the reward the customer will receive for completion
customerActionsCompletedintThe number of actions completed (if applicable)
customerCanParticipatebooleanBased on the rules, can this customer participate right now
customerCompletedbooleanFlag indicating whether the campaign has been completed or not
customerCompletionsintThe number of times the customer has completed the campaign
customerMinutesUntilNextParticipationintThe number of minutes left until the customer can participate in the campaign again
customerHoursUntilNextParticipationintThe number of hours left until customer can participate in the campaign again
customerDaysUntilNextParticipationintThe number of days left until customer can participate in the campaign again
backgroundImageURLstringThe hosted URL of the image associated with the campaign in the Swell admin
rewardTypestringThe type of reward/redemption associated with the campaign.
rewardPercentageintShows progress on Goal Spend/Punch Card campaign
rewardPointsintThe number of points associated with completing this campaign
campaignTiersarrayThis attribute will populate if there's a tier restriction on the campaign