Campaign Promotions Embed Element example
The Campaign Promotions Element shows a list of incentive campaign promotions from Spaaza, personalised to the authenticated user. Each promotion is displayed in a card-based layout.
A campaign promotion’s purpose is to publicize a particular campaign to a user and incentivise them to perform a desired action or set of actions.
Campaigns are created and managed in Spaaza Console and a campaign’s content, promotion styling (background colours and images, etc) and layout style can also be managed here.
The Element’s properties allow a developer to filter which campaigns promotions they want to display to a user, or which they do not. For example:
- a list of campaign promotions that are only for earning or spending points
- a list of campaign promotions that only apply to webshop sales
“Discount” campaigns promotions are excluded from this element. To display promotional campaigns use the Price Promotions Element.
If you do not want to show campaign promotions in card format the Campaign List Element, which displays campaign promotions in a more simple list view, may be a better solution.
If you only want to show a single, specific campaign promotion and know the ID of that campaign the Campaign Promotion Element may be a better solution.
The Campaign Promotions Element is similar to the Campaign List Element which will also return a list of campaigns for a user. It differs from the Campaign List Element in that it has more pronounced styling and the possibliity of different layouts. Developers can choose which Element suits their needs best or use both in different scenarios.
To include a list of Campaign Promotions 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-promotions.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-promotions loading="2" includetags="webshop"></spaaza-campaign-promotions> <!-- other Spaaza Elements and HTML goes here --> </spaaza-environment>
The following optional properties can be passed:
|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.|
|excludetypes (optional)||A comma separated list (no spaces) of Spaaza campaign types. If set, campaigns of that type will not be returned.|
|includetypes (optional)||A comma separated list (no spaces) of Spaaza campaign types. If set, only campaigns of that type will be returned.|
|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.|
|direction (optional)||Determines the direction the campaign promotions will rendered on the page. There are three options: “row”, “row-wrap” or “column”. The default direction is “row-wrap”|
|appearance (optional)||Determines the card display style. There are two options: “flat” or “raised”. The default is “raised”.|