When dealing with form submissions, sometimes you’ll encounter a situation where you need to capture a value from the form, and store it for retrieval and inclusion when the form is successfully submitted. Sound like a confusing scenario? Let’s look at this example.

Suppose you have a checkbox on your form that the visitor can select to give you permission to send newsletters to. Rather than firing on form submit, you want to pass this data only when the form is successfully submitted. This case assumes that the successful form submission loads a confirmation page or message.

There are a few steps you need to take in Adobe DTM to make this happen.

1. Create a data element of type cookie. Be sure to give it a name that you will remember.

2. Create an event-based rule with the event type set to “click”. Enter the selector for the form submit button. Add a custom rule condition. Writing the code for this custom rule condition is the most technical part. The code needs to create an empty variable, assign the value from the form, set the value in the cookie referenced in the data element and return true. Returning true ensures your event rule fires. Your code might look something like this:

var newsSub = ”;

if($(‘’).length == 1){

newsSub = ‘true’;



return true;

3. The final step is to use the data element to set the value wherever you would like to for the form submission success event rule, e.g. %newsSubCookieName%.

With this method, you can create cookies with Adobe DTM that allow you to store values for future retrieval.