Hi @SanfordWhiteman thanks a lot for the script.
Referral email data gets appended correctly, but I'm running into an issue with consistently getting 3 duplicate referrals being created on Marketo (4 in total). Any idea what can cause this?
No way to tell without linking to your page.
I had your Codepen embedded on the form itself as a script in rich text field. After moving it to the landing page, everything looks to be working correctly.
Is it possible to append a data point from the referrer to the newly created, referred lead? Say, I want to move a CSM owner field value that the referrer has, can I add this to the script if we know that value at form fill?
I had your Codepen embedded on the form itself as a script in rich text field. After moving it to the landing page, everything looks to be working correctly.
Yes, it’s not safe to simply drop scripts into Rich Text areas, as they’ll run multiple times. There’s a blog post about this specific case.
Is it possible to append a data point from the referrer to the newly created, referred lead? Say, I want to move a CSM owner field value that the referrer has, can I add this to the script if we know that value at form fill?
You mean if you know the value via Pre-Fill?
Sure, any hidden field that’s not specifically removed is already added to the referral lead.
So if you had CSM Name in a hidden field it would be taken from the referrer and posted to the referral (as well as being posted back to the referrer with the same value).
Thank you @Darshil_Shah1 and @SanfordWhiteman ! I do have a follow-up question and this pertains to attribution:
How would I create attribution in the sense of, if one person referred to multiple people? How would the referee details (the email addresses) be associated with that referrer record? Say, if a person fills out a form 10 times, to refer 10 different people?
And finally, it appears the form cannot be submitted more than once (more than one referrer, whether it's the same referrer or not (with a new referee)).
I've tried submitting the form using a different IP address as well - still, the new submission isn't working. I run a Smart List looking at the form submissions, and it only shows the two initial submissions (referrer and referee). Is the script somehow limited to one submission?
Well, you can have a text field to store all the referees’ email address, you can append referee’s email address to this text field each time a referrer fills out the form. Also, you would not want to clear the referee email address while making the 1st POST request in the script- use the data in referee email address field to append to a separate text area field (you can create a campaign to do this).
Also, script does not restrict a referrer from submitting the form multiple times - all the script does is Post referrer form data - Map data for the referee form submission - Post referee form data.
If you share the script you’re using (consider white labelling form - id/munchkin id/base url) with us, we can help look as to why a referrer isn’t allowed to submit form multiple times.
How do I prevent the Referee email address field from clearing whilst making the first post @Darshil_Shah1 ? Do you mind posting a code snippet, please?
I quite like the idea of using a Smart Campaign to append the referee emails to a text field, @Darshil_Shah1 . I assume I'd use some simple logic to handle this, right? I.e. Fills out Form > Change Data Value (text field >> {{referee.referee field}}). Is this correct? Or will Change Data Value update the text field with a new value every time...? I'm thinking it will...?
The form is now submitting new data too by the way! There had to be some delay in the Smart List updating for some reason.
@Darshil_Shah1 I found this article for appending data to a text field.. This is correct, right? Also - does it have to be a free text field? Or can it be a simple string? Thank you!
@MarianoAdunseCO wrote:
How do I prevent the Referee email address field from clearing whilst making the first post @Darshil_Shah1 ? Do you mind posting a code snippet, please?
Well, it's pretty straight forward - just remove the setValues method from the referrer's form post - and clear out the value of the referee's email address field used on the form during the form post 2, i.e., during the referee's form post. Refer below:
MktoForms2.whenReady(function(form) {
var originalValues;
form.addHiddenFields({'_mkt_trk':''});
form.onSubmit(function(form) {
originalValues = form.getValues();
})
form.onSuccess(function(vals, thankYouURL) {
this.onSuccess(); // clear onSuccess for 2nd run
this.setValues({
'LastName': '',
'FirstName': '',
'Email_Address_2__c':'', //Replace 'Email_Address_2__c' with the API name of the Referee's email field
'_mkt_trk': '',
'Email': originalValues['Email_Address_2__c']
/* Add the API name of the Email Address in the Key ('Email') and Referee's email address field in the value, i.e., replace 'Email_Address_2__c' with the referee email field's API name in the originalValues['Email_Address_2__c']*/
});
this.submit(); // send it again
}.bind(form));
});
I quite like the idea of using a Smart Campaign to append the referee emails to a text field, @Darshil_Shah1 . I assume I'd use some simple logic to handle this, right? I.e. Fills out Form > Change Data Value (text field >> {{referee.referee field}}). Is this correct? Or will Change Data Value update the text field with a new value every time...? I'm thinking it will...?
Yeah - you would want to trigger on the fills out form activity, in the flow I would recommend clearing out the data from referee's email address field, after appending the data to the text area field - you can add in the filter in the SL to check for the non-empty values for the Referee's email address field. Your smart campaign should look something like below (I've used the placeholder field/form names - change them as per your setup).
If required, you can add a condition in the 1st change data value flow step to ensure that you do not end up re-adding the same referee email address field in case the referrer refers the same person more than once. The flow in that case would look something like below:
Also, make sure you update the campaign qualification rules to allow people to run through the campaign multiple times.
@Darshil_Shah1 I found this article for appending data to a text field.. This is correct, right? Also - does it have to be a free text field? Or can it be a simple string? Thank you!
Well, string field has a character limit of 255 chars - data beyond the 255th char will get truncated thereby limiting the number of email addresses that you can store in the field. The text area field enjoys much higher character limit of 65535 chars when updated via GUI/API - which should be sufficient for storing quite a lot of email addresses (at least much more than a typical referrer would refer).
@Darshil_Shah1 That worked, thank you! The data is feeding correctly - and I've triple-checked with multiple submissions. Thanks again, you're an asset to the community, along with @SanfordWhiteman !
That is awesome, @MarianoAdunseCO! Glad to be able to help.