RE: segments and form handler
Hey Georgie, excellent use case. The easiest way to do this tracking is to:
1. Add a hidden field on your form, and map it to your contact/lead
2. On the form submission, use Javascript to pass the value of the channel (which you can pick from the URL, which is where I'm assuming you're keeping the channel field) as a part of the form submission by setting the value of the hidden field as this channel.
Here's a sample script for your landing page with the form, which takes all the parameters in the URL and adds them to the hidden fields array. You can of course simplify it if you're just using a single field.
<script>
MsCrmMkt.MsCrmFormLoader.afterformload = function(formPageId)
{
var self = window.location.toString();
var queryString = self.split("?");
var hiddenFields = document.querySelectorAll("input[type=hidden]");
if (queryString.length > 1)
{
var pairs = queryString[1].split("&");
for (var pairIndex in pairs)
{
var pair = pairs[pairIndex].split("=");
if (pair.length !== 2)
{
continue;
}
var key = pair[0];
var value = pair[1];
if (key && value)
{
for (var i = 0; i < hiddenFields.length; i++)
{
if (hiddenFields[i].id === key)
{
hiddenFields[i].value = value;
}
}
}
}
}
}
</script>