I have to track the info on a pop up form when user click the submit button. I noticed that when the rule fire and if the form submit successfully, then I can not get any form info. If the form submit fail, then I can get all the info. This seems to me that the click button happen first and then the info already lost. Is there a way allow to to grab the form info before the form submit?
One way would be to store the values of the form fields as session storage items, once a 'blur' event occurs on the input field.
For example, if you're using jQuery and you have simple text input fields you could do:
// cancel if no data or if the input field is type "submit"
if (!$(this).val() || $(this).attr('type') === 'submit') return;
// get the value of the input field
var inputFieldValue = $(this).val();
// get the field name
var inputFieldName = $(this).attr('name') // or your own selector for the field name - you know your app better than i do!
// write the data to session storage
if (inputFieldValue && inputFieldName) sessionStorage.setItem('fa_field_' + inputFieldName,inputFieldValue);
From here, just can make sure that your custom event process scrapes the content of session storage items that have an index of 'fa_field_', and allocate them to their respective eVars or context data properties (depending on your implementation).
For example, let's assume your form has four different input fields:
Input Field Name
Session Storage Item Name
Input Field Value / Session Storage Item Value
Adobe Analytics Conversion Variable
From here, we want to allocate each of the of these input field values to a respective s.evarX property so that it's included in the server call to Adobe Analytics:
Sorry, there was additional code examples in there for scrapping the session storage items and adding the right ones to the respective s.eVarX property, but it didn't save the post properly when I commited the reply
It should work if you're triggering the image request on the onClick event. Does the information instantly disappear on your form when you hit submit? That would be the only reason why I'd anticipate it not working.