Data scripting/Data object
You can use your script by using:
- the data-script attribute on <a> tags
- the flowchart editor in the follow-up form
Warning: You need the new link tracking system to use data-scripts. If you're using Marketing Suite this is already enabled, but Publisher users have to enable the system manually in their account settings.
Inside the script you can make use of a couple of global variables that identify the (sub)profile that clicked on the link and other relevant data. Each of these objects have read-only properties to get data, others have write properties as well. The following variables are accessible:
|template||Standard template (only MS)|
|document||Emailing document (only Publisher)|
|destination||Alias to profile/subprofile|
A few of these objects also have the data object, which you can use to store your own information regarding the object.
A very simple example
A possibility of the data-script object is to change profile data when a link is clicked. This can be used to place an unsubscribe link that when clicked sets a profile setting to indicate this person doesn't want to receive newsletters anymore. Note that this functionality is also available in the unsubscribe settings, but this is a simple example to get you started.
<a href="http://www.example.com/unsubscribe" data-script="profile.fields.newsletter = 'no';">Click here to unsubscribe</a>
When the script is executed (on click) the profile will be updated. Now you can make your own newsletter selection to make sure you only send mail to people who are subscribed to your newsletter.
Before an email is delivered, the data-script is removed from the original code. Your receivers therefore do not get to see the script when they open the source code of the message. However, the script stays active because Copernica has stored the script and runs it when a click is registered.