You are able to update a contact attribute by using the Smarty attribute crdl-setAttribute
within an anchor tag. Note: It is necessary to have link tracking enabled in order for this feature to work.
Update a string attribute
The following code will update the string attribute "flavor" with the value of "vanilla".
<a href="http://www.example.com" crdl-setAttribute-flavor="vanilla">Click to set flavor to "vanilla".</a>
Update a number attribute
The following code will update the number attribute "points" with the value of "10".
<a href="http://www.example.com" crdl-setAttribute-points="10">Click to set points to "10".</a>
Increment a number attribute
Using the syntax :inc
allows you to increment or decrement the value of a number attribute by providing a positive or negative value.
The following code will increment the number attribute "points" by "3".
<a href="http://www.example.com" crdl-setAttribute-points:inc="3">Click to increment the points value by "3".</a>
The following code will decrement the number attribute "points" by "3".
<a href="http://www.example.com" crdl-setAttribute-points:inc="-3">Click to decrement the points value by "3".</a>
Update a date attribute
The following code will update the date attribute "expiration" to the current date.
<a href="http://www.example.com" crdl-setAttribute-expiration={$smarty.now|date_format}>click to set expiration date to today.</a>
The following code will update the date attribute "expiration" to 30 days in the future.
<a href="http://www.example.com" crdl-setAttribute-expiration={"+30 days"|date_format}>click to set expiration date to 30 days in the future.</a>
The following code will update the date attribute "expiration" to 30 days in the past.
<a href="http://www.example.com" crdl-setAttribute-expiration={"-30 days"|date_format}>click to set expiration date to 30 days in the past.</a>
Update an array attribute
The following code will update the array attribute "categories" with the values "apparel", "electronics" and "home".
<a href="http://www.example.com" crdl-setAttribute-categories="apparel,electronics,home">click to set the "categories" array with the values "apparel,electronics,home".</a>
In the next article learn how to disable link tracking.
Comments
0 comments
Please sign in to leave a comment.