What's the URL of the test LP?
The code assumes the name of your Lead Source Detail field is, literally, "Lead Source Detail".
You don't want to (don't need to) add this field to the form at all. An you definitely don't want to set it to retrieve from the Referrer, because that's not what you're considering the Lead Source Detail! You've said yourself the Lead Source Detail is the URL of the current page -- the Referrer is the previous page. Anyway, the code adds the field to the form. You should remove it from your form on the Marketo side.
1) The URL for the LP that I'm testing with is http://info.<company>.com/Web-A-Little-Riak-Book-LP.html
(I took the company name out because it kept resolving to the page name. You can insert "basho" for <company>)
2) The name of my field is literally "Lead Source Detail"
3) I put the hidden field on the form because in your msg at 10:52 you said "Not instead of the form, in addition to the form."
4) That makes sense about the referrer except that when I look in the activity log at the detail behind fills out form I see "Refferer URL:" followed by the URL for the LP
5) I removed the hidden field from the form but it still doesn't work. 6) Given that the field is literally "Lead Source Detail", how is that extrapolated from your code when your code says "LeadSourceDetail" (no spaces)? Should the code use the API name instead (Lead_Source_Detail__c)? Does it matter that there is a space in the code between "LeadSourceDetail" and the colon?
I appreciate your patience and will totally understand if you can't spend anymore time on this.
Oh, my god, it worked!!!! So cool!!!! Thank you!!!!!!!!!!
Great!
Even easier:
block field updates
Now when ever the form gets completed and a lead is generated, the "Source" field will be populated with "Website"
AND, to stop this being over-ridden if they fill in another form, go to admin > field management > field actions > block field updates
Select from the list which methods you want to block, I always select Form Fill, Flow change, Lead detail fill, Web Service API, Webhook
This still allows you to update it with a workflow, but stops sales changing it or another form over-ridding the original value.
Then just make sure the field is mapped through your connector and you have the corresponding setup created in your CRM.
How does that fill in the Lead Source Detail?
Hi Julia,
That's an easier way to set Lead Source - thank you. Sandford is right thought that it doesn't help with Lead Source Detail.
Denise
Yep, copying the last token of the pathname (the "page name" in lay terms) into a field isn't an automatic function, so it needs to be done as I noted. Did you try my code?
No - because I wasn't sure:
1) If it was complete as is or if I had to fill in "pathname" with something specific
2) where to put the code
Do I just copy and paste it as is? If so, where do I put it? I'm excited to try it!