Campaign List Element
The Campaign List Element shows a list of incentive campaigns from Spaaza, personalised to the authenticated user.
Campaigns are created and managed in Spaaza Console but the Element properties allow a developer to filter which campaigns they want to display to a user, or which they do not. For example:
- a list of campaigns that are only for earning or spending points
- a list of campaigns that only apply to webshop sales
By default this Element will show campaigns in a simple list view, in which case some simple styling can be passed into the Element as properties. However, it is also possible to display each campaign in a card view, in which case the styling (background colours and images, layout, etc) is controlled in Console in the Campaign Settings.
Promotional campaigns are by excluded from the this list. To display promotional campaigns use the Price Promotions Element.
Using the Campaign List Element
To include a Campaign List on a webpage do the following:
- Add the following script tags at the top of the page
<script type="module" src="https://elements.spaaza.com/elem/spaaza-environment.js"></script> <script type="module" src="https://elements.spaaza.com/elem/spaaza-campaign-list.js"></script>
- Add the Environment tag to the contents of the page (below the script tags). Include the Campaign List within the Environment tag
<spaaza-environment config="your_config_goes_here"> <h3>Webshop-only benefits for members</h3> <spaaza-campaign-list loading="2" includetags="webshop"></spaaza-campaign-list> <!-- other Spaaza Elements and HTML goes here --> </spaaza-environment>
The following optional properties can be passed to the Campaign List.
|recipient (optional)||The id of a recipient wallet. Include this if you want to only show campaigns that will add or subtract value for the specified wallet.|
|type (optional)||If included, only campaigns of that type will be shown.|
|includetags (optional)||Campaigns can have one or more tags. If included, campaigns with one or more matching tags will be show. A list of tags can be used in which case the tag names should be separated by commas (with no spaces), for example “autumn-promos,webshop”.|
|excludetags (optional)||Campaigns can have one or more tags. If included, campaigns with the specified tags will be excluded. A list of tags can be used in which case the tag names should be separated by commas (with no spaces), for example “influencer,employee”.|
|loading (optional)||By default a single campaign list item is shown as loading while waiting for a response from the Spaaza API. More can be shown by specifying the required number. To show no loading campaigns set the value to 0.|