SOLVED

Assigning Lead Source & Lead Source Detail form Web Form Fills

Go to solution
Anonymous
Not applicable

I have a client who just re-vamped their web site. When they did this they created Marketo LPs for each of the white papers and other assets on their site in Design Studio. I'm trying to figure out the best way to assign Lead Source and Lead Source Detail for leads who are created when they visit the web site and click through to an LP in order to download an asset. In other words, these are leads who are not part of a program. They found their own way to the LP. What the client wants, in that case is:

Lead Source: Website

Lead Source Detail: Asset Name (which is included in the name and URL of each LP)

I assume I can assign Lead Source to Website with a campaign with this Smart List:

Trigger:

New Lead is Created

Source Type is Web form fillout

Filter:

Member of Program is False

Program is Any

It's the Lead Source Detail I'm not sure how to handle. An obvious solution would be to use a hidden field on the Form(s). But the Form used on their WP LPs is also used by LPs in a number of Programs which contain campaigns that are setting the lead source and lead source detail to reference those programs (E.g., Lead Source: Content Syndication; Lead Source Detail: <CS Vendor Name>).

I can think of 2 solutions but both are fairly laborious:

1) Create Programs for all the Web Site Assets and move the LPs out of Design Studio and into the Programs. Create campaigns in each program to set the Source fields.

2) Create a separate form to be used on LPs for WPs downloaded directly from the web site and use hidden fields (it's laborious simply because there are a large number of LPs).

Does anyone have a better idea (or am I missing something simple and obvious)?

Thanks in advance!

Denise

1 ACCEPTED SOLUTION
SanfordWhiteman
Level 10 - Community Moderator

Yes, use the API name Lead_Source_Detail__c

The space doesn't matter.

View solution in original post

20 REPLIES 20
Anonymous
Not applicable

Even easier:

  1. Add a field to your form "Source"
  2. Change the field type [in form editor] to "hidden"
  3. Set the Autofill option by clicking on "edit" and type what you want set your source as i.e. - Website

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.

Anonymous
Not applicable

Hi Julia,

Just to be complete - actually that wouldn't solve my problem because the form is shared by other programs where I don't want the source to be website. So I think my campaign would work best for that and hopefully Sanford has the solution to Lead Source Detail if I can just comprehend it!

Denise

Anonymous
Not applicable

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

SanfordWhiteman
Level 10 - Community Moderator

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?

Anonymous
Not applicable

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!

SanfordWhiteman
Level 10 - Community Moderator

How does that fill in the Lead Source Detail?

SanfordWhiteman
Level 10 - Community Moderator

If the Lead Source Detail is "included in the name and URL of each LP" -- by which I assume you mean the URL has a query param like &assetName=whitepaper1.pdf -- then set a hidden field that pulls the value from that param.

Anonymous
Not applicable

Hi Sanford,

All I meant was that the URL for the LP contained the asset name: white-paper123-LP.html.

I forgot to mention the 3rd solution of adding a parameter to the URLs on the client's web site linking to the LPs (in which case your suggestion would work). (That's also a challenge because my contact doesn't know how to do that nor have easy access to a resource who can do it for her).

Thank you!

SanfordWhiteman
Level 10 - Community Moderator

So parse out the page name (document.location.pathname) and set a hidden field from that:

MktoForms2.whenReady(function(form){

    form.addHiddenFields({ LeadSourceDetail : document.location.pathname});

});

Anonymous
Not applicable

Sanford,

I'm not a developer and don't quite follow your suggestion, forgive me. Where would I put that code? And the pathname will be different for each document. So how would it be retrieved?

Unless I can grasp and implement your solution, I think the best bet is to have the client bite the bullet and get someone to go in and change the URLs linking to the LPs on their web site to include parameters for Lead Source Detail to populate a hidden form field.

Denise

SanfordWhiteman
Level 10 - Community Moderator

The pathname is different for each document, yes -- and we can always read the current document's pathname from any web page using the built-in variable document.location.pathname. 

When viewing /example1.html, document.location.pathname is "/example1.html".  When viewing /any-page-you-want.html, document.location.pathname is "/any-page-you-want.html".  It automatically gets populated by the browser.

In Landing Page Editor, just an add an HTML block with these contents.

<SCRIPT>

MktoForms2.whenReady(function(form){

    form.addHiddenFields({ LeadSourceDetail : document.location.pathname});

});

</SCRIPT>

Anonymous
Not applicable

Hey Sanford -

I'm sorry - I just realized I'm seeing your posts out of order and I didn't see the one above that tells me to add the HTML block until after I asked you where to put the code. Are you saying that this code would get added to each Landing Page (rather than the form)?

And sorry to be obtuse - but when you say "add an HTML bock", do I need something around that script or can I just plop it in anywhere?

Denise

SanfordWhiteman
Level 10 - Community Moderator

Not instead of the form, in addition to the form.

In freeform LP Editor, drag the "HTML" icon onto the page. Then click the gear icon and click Edit.

Anonymous
Not applicable

I implemented your code on a test LP but can't figure out how to get the Lead Source Detail populated, I can see "LeadSourceDetail: /Web-A-Little-Riak-Book-LP.html" this when I looked at the lead activity log and click on the detail for Filled Out Form but the Lead Source Detail field is still empty. I have a hidden field on the form and selected Referrer Parameter for where it should get the value. I'm not sure what I should be using for Parameter Name. I've tried lots of options but none have worked. I'm guessing that's the problem but am out of ideas.

SanfordWhiteman
Level 10 - Community Moderator

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.

Anonymous
Not applicable

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.

SanfordWhiteman
Level 10 - Community Moderator

Yes, use the API name Lead_Source_Detail__c

The space doesn't matter.

Anonymous
Not applicable

Oh, my god, it worked!!!! So cool!!!! Thank you!!!!!!!!!!

SanfordWhiteman
Level 10 - Community Moderator

Great!

Anonymous
Not applicable

Where do I tell the hidden field on the form to get the value from?