Campaign Object
You can access information about a campaign by using the campaign object. These can be used within email templates, with over 260 calls, to create reusable template content.
As well as containing the basic campaign attributes, the campaign object also contains project, workspace, unsub list, owner user and campaign option objects. This allows you to follow the different hierarchical levels of the platform for a huge range of information, accessed in a logical manner.
On this page:
- Campaign Object
- User Object
- Project Object
- Workspace Object
- Unsub List Object
- Campaign Options Object
- Hierarchy Structure
- Brand Object
- Product Object
- Location Object
Campaign Object
The campaign object is the main object, and can be used to find immediate campaign information or further account information.
- Campaign Name: [* campaign.name *]
- Campaign's subject line: [* campaign.options.subject_line *]
- Project Owner ID: [* campaign.project.owner_user_id *]
Attribute | Type | Description |
---|---|---|
id | Integer | ID for the campaign |
name | String | The campaign name |
description | String | Description given to campaign |
project | Object | Opens up the Project object and its attributes |
project_id | Integer | ID of Project the campaign is within |
owner_user | Object | Opens up the User object and its attributes |
owner_user_id | Integer | ID of the user that owns the campaign |
colour | String | Hex colour description for the campaign (e.g.#DC143C) |
list_id | Integer | ID of the list associated to the campaign |
unsub_list | Object | Opens up the Unsub List object and its attributes |
filter_id | Integer | ID of the filter associated to the campaign |
client_ref | String | The client reference value |
published | Boolean | Returns 1 if the campaign has been published, otherwise 0 |
edited | Boolean | Returns 1 if campaign has been edited since last publication, otherwise 0 (this covers edits to Options and Message data |
launched | Boolean | Returns a 1 if campaign has been launched, otherwise 0 |
options | Object | Opens up the Campaign Options object and its attributes |
User Object
The User object, can be used to find information of the user that owns a certain property (campaign, project, workspace or unsub list).
- Campaign owner name: [* campaign.owner_user.name *]
- Workspace owner id: [* campaign.project.workspace.owner_user.id *]
- Unsub List owner username: [* campaign.unsub_list.owner_user.username *]
Attribute | Type | Description |
---|---|---|
id | Integer | ID of the user |
name | String | User's actual name |
username | String | User's login name |
String | User's email address |
Project Object
The Project object enables you find information about the project which the initial campaign object is attributed to.
- Project description: [* campaign.project.description *]
- Project's workspace name: [* campaign.project.workspace.name *]
Attribute | Type | Description |
---|---|---|
id | Integer | ID for the project |
name | String | Project name |
description | String | Description given to the project |
owner_user_id | Integer | ID of the project owner |
workspace_id | Integer | ID of the workspace the project is in |
colour | String | Hex colour description for the campaign (e.g.#DC143C) |
owner_user | Object | Opens up the User Object and its attributes |
workspace | Object | Opens up the Workspace Object and its attributes |
Workspace Object
The workspace object can only be used in conjunction with the Project object, e.g. [* campaign.project.workspace.id *]
Attribute | Type | Description |
---|---|---|
id | Integer | ID for the workspace |
name | String | Name of the workspace |
description | String | Description given to the workspace |
owner_user_id | Integer | ID of the workspace owner |
colour | String | Hex colour description for the campaign (e.g.#DC143C) |
owner_user | Object | Opens up the User Object and its attributes |
Unsub List Object
The Unsub List object enables you to obtain information of a campaign's unsub list.
- Unsub List name: [* campaign.unsub_list.name *]
Attribute | Type | Description |
---|---|---|
id | Integer | ID of the unsub list |
name | String | Name of the unsub list |
description | String | Description given to the unsub list |
owner_user_id | Integer | ID of the unsub list owner |
owner_user | Object | Opens up the User Object and its attributes |
Campaign Options Object
The Campaign options object will allow you to find out specific information on the campaign itself.
- Campaign From Address: [* campaign.options.from_address *]
- Campaign boilerplate: [* campaign.options.boilerplate *]
- Is campaign tracking enabled: [* campaign.options.auto_tracking *]
Attribute | Type | Description |
---|---|---|
from_prefix | String | The prefix used on return path addresses, and from/reply addresses when they're not overidden using user_from/user_reply |
user_from | Boolean | A 1 or 0 to indicate whether to use the from_address in the From header, or to generate a tracked address |
from_address | String | Custom from address header to use. Note that you must also set user_from to 1 for the system to use this address |
from_name | String | The name part of the From header |
user_reply | Boolean | A 1 or 0 to indicate whether to use the reply_address in the Reply-To header, or to generate a tracked address |
reply_name | String | The name part of the Reply header |
reply_address | String | Custom reply address header to use. Note that you must also set user_reply to 1 for the system to use this address |
subject_line | String | The campaign's subject line |
text_preference_field | String | The core or data table ID and name of a field (e.g. '181.text_pref') that indicates the contacts who prefer or require emails in text format only |
boilerplate | Integer | The ID of the boilerplate in use |
remote_data_url | String | The URL for your remote XML feed |
domain | String | The domain to be used in click URLs, and for automatically-generated from and reply addresses |
auto_tracking | Boolean | A 1 or 0 to indicate whether your campaign will automatically track the opens, email clients and geo location of your contacts |
text_unsub | Boolean | A 1 or 0 to indicate whether to insert an unsubscribe link into the text parts of the campaign |
html_unsub | Boolean | A 1 or 0 to indicate whether to insert an unsubscribe link into the HTML parts of the campaign |
unsub_url | String | The unsubscribe page URL |
unsub_list | Boolean | The ID of the default unsub list to be used with this campaign. Members of the unsub list will be suppressed from the launch, and addresses of those who unsubscribe will be added to this unsub list |
suppress_lists | String | Unsub list IDs to use for suppression in addition to the selected unsub list |
Hierarchy Structure
The campaign object API follows the hierarchical structure of the platform for a logical way of obtaining account information.
For example:
A campaign's owner can be found with:
[* campaign.owner_user.name *]
The owner of the project that the campaign is in can be found with:
[* campaign.project.owner_user.name *]
And the owner of the workspace that contains both of these can be obtained with:
[* campaign.project.owner_user.name *]
Brand Object
The brands result set can be used to find information related to a specific brand. Whether Brand information, or products and locations.
Iterating over Brands
You must iterate over the brands result set, to return a brand object.
- List of brands available to the campaign: [* campaign.brands.all *]
- First brand result that matches search term: [* campaign.brands.search({name = '$brandname'}).first *]
- Order results by column name: [* campaign.brands.orderby('$columnname', 'asc|desc') *]
Attrbute | Type | Description |
---|---|---|
all | Array | Returns a list of Brand objects |
search | Result Set | Returns result set of brand objects, that match search term |
find | Result Object | Returns the first brand object that matches the find term |
orderby | Result Set | Returns result set of brand objects, ordered by given column name |
first | Result Object | Returns first brand object in the result set |
count | Integer | Returns total number of brand objects in the result set |
Brand Information
Use the iterator attributes above, to find a specific brand object.
- Return the ID of the brand: [* campaign.brands.find('MyBrand').id *]
Attribute | Type | Description |
---|---|---|
id | Integer | Returns ID of brand |
name | String | Returns the given brand name |
description | String | Returns the given description for the brand |
Product Object
Use the brand object, to obtain results for products.
- List of products within a brand: [* brand.products.all *]
- To find a specific product by reference: [* brand.product('ProdRef000') *]
Note: You also use the iterator methods shown above, with the product results
Attribute | Type | Description |
---|---|---|
name | String | Name of product |
ref | String | Product Reference |
url | String | URL for the product |
image_url | String | Image URL of product |
data | HashRef | User defined additional data |
brand_id | Integer | The ID of the brand the product is related to |
Searching by Tags
Using the Product Object you can use the search_by_tag method, to search for products matching the given search term.
- List of products that match given tag name: [* brand.products.search_by_tag(name = 'TagName').all *]
- List of products that match given tag value: [* brand.products.search_by_tag(value = 'TagVal').all *]
Product Popularity
Note: This feature is currently in Beta testing. If you'd like more information contact your account manager.
- Pull through popular products to your campaigns
- Organise by overall products or category
- Improve campaign engagement with your best selling products
A new template directive will allow you to pull through your products based on their popularity - whether overall or within a category. This will help to improve campaign engagement by showing your most popular products with your contacts, and is another step forward in our transactional capabilities.
Location Object
- Search for a location by postal code: [* brand.locations.search_by_postal_code('MyPostalCode').all *] (UK only)
- Find a location name by unique identifier: [* brand('MyBrand').location('MyIdentifier').name *]
Note: You also use the iterator methods shown above, with the location results
Attribute | Type | Description |
---|---|---|
name | String | Name of product |
brand_id | Integer | ID of the brand, the location is related to |
identifier | String | Unique identifier for the location |
description | String | Description of the location |
address | String | Address of the location |
postal_code | String | Postal code of the location (20char. limit) |
country_code | String | Country code identifier (2char. limit) |
data | HashRef | User defined additional data for the location |
Find Nearby Locations
Find a location, in this instance returning its name, that is within a given distance of the postal code. This will allow you to search for locations near to your contacts.
Note: This is currently only available to UK postal codes.
[* brand('MyBrand').locations.find_nearest({postal_code = 'MyPostalCode', country = 'UK', distance = '10 miles'}).name *]