Data scripts and -objects
Data scripts allow you to link follow-up actions to various triggers. These scripts are executed by Copernica whenever a trigger is activated. This works in a similar way to scripts that are placed in a hyperlink as an 'onclick' attribute, with one key difference: scripts are executed on Copernica servers instead of in the browser.
You can add data scripts in the Marketing Suite by:
- Placing the data script attribute within an <a> tag;
- Adding them in the Email editor.
You can also create your own triggers and actions in the Follow-up Manager.
Note: The use of data scripts requires the latest link tracking system, which is automatically enabled within Marketing Suite. If you're using Publisher, you'll need to enable it manually in your account settings.
Available objects
There are various objects available for use in data scripts. These objects allow you to retrieve and edit data from your account. The following objects are available:
Object name | Description |
---|---|
copernica | Copernica account |
mailing | Previous mailing |
message | Personalized template |
template | Standard template |
document | Mailing document (Publisher only) |
database | Database |
collection | Collection |
profile | Profile |
subprofile | Subprofile |
destination | Profile/subprofile alias |
Each of the above objects utilizes a data object, which can be used to store information about the object.
Example
You can use the data script object to modify profile data whenever a link is clicked:
<a href="http://www.example.com/unsubscribe" data-script="profile.fields.newsletter = 'no';">Click here to unsubscribe</a>
In the above example, a click would result in the 'newsletter' field being set to 'no'. This is just a simple example: the functionality also allows you to execute highly complex scripts.
Data scripts are never visible for inspection in the email's source code. Instead, the data script is removed from the source code shortly prior to sending. It is therefore invisible to the recipient.