SOLVED

Re: Referrer Parameter

Go to solution
SanfordWhiteman
Level 10 - Community Moderator

Re: Referrer Parameter

Carey, I answered that question above.

Anonymous
Not applicable

Re: Referrer Parameter

Thanks Sanford. I went back and read the thread where you replied. To be honest, I'm more of an Marketo end user than a developer. Can you tell me specifically what I should type in the field "Referrer Parameter"? We are embedding these forms on our website, so they just have an URL address such as www.assetworks.com/products/fleetfocus-fleet-management-software

Is it possible for us to see that address as the Referrer parameter without appending anything the URL itself?

SanfordWhiteman
Level 10 - Community Moderator

Re: Referrer Parameter

You don't need to append to anything.  But you do need to have a custom Lead field in your Marketo database to hold the value!  You can call this field lastReferrerURL.

Then, in your landing page, after the embed code, put this SCRIPT block:

<SCRIPT>

MktoForms2.whenReady(function(form){

    form.addHiddenFields({ lastReferrerURL: document.referrer })

});

</SCRIPT>

Bear in mind that not all pages will have a Referrer, even if they appear to have a "previous page."  This is one very good reason that this functionality is not enabled by default, because it would confuse most users.  For example, if someone clicks on an ad on https://somedomainrelevanttomyvertical.com to go to http://assetworks.com/landingpage1.html (note that your page is not https://) then you will not see a Referrer.  This part of the definition of how Referrers work and is not unique to Marketo.

Anonymous
Not applicable

Re: Referrer Parameter

Is there a way to do that for the source URL? I have a field called "Lead_Source_Details" where I can store it.

My ultimate goal based on your example would be to see a form fill that looks like this:

Name:     John Smith

email:      john@smith.com

Lead Source Details:     http://assetworks.com/landingpage1.html

SanfordWhiteman
Level 10 - Community Moderator

Re: Referrer Parameter

    form.addHiddenFields({ Lead_Source_Details : document.location.href });

But because a form can exist on many pages, those pages can be renamed, and each of those pages can be linked to from various sources, it's relatively uncommon to rely solely on the current URL.  Rather, that's why you have hidden field options like "autofill from URL parameter," so you can set the lead source details there and it'll work on both /landingpage1.html?lead_source_details=sourceA and /landingpage223344.html?lead_source_details=sourceA.

SanfordWhiteman
Level 10 - Community Moderator

Re: Referrer Parameter

Also note that the hosting web page already is logged and can be used as a trigger, though that's not exactly the same as saving it to the lead.

Anonymous
Not applicable

Re: Referrer Parameter

Hi Sanford,

Again, great post and advice. I was created the exact same custom field and also added the exact same scripts to the landing page. However, when I filled the form and new lead did not capture the last referrer url.

Referrer URL:  http://info.mydomain.com/ABC  ( marketo landing page)

Landing Page URL: http://info.mydomain.com/DEF​ ( another marketing landing page)

Any idea why it did not work?

Vincent

SanfordWhiteman
Level 10 - Community Moderator

Re: Referrer Parameter

What's the actual URL, so I can verify your setup?

Anonymous
Not applicable

Re: Referrer Parameter

SanfordWhiteman
Level 10 - Community Moderator

Re: Referrer Parameter

Syntax error (which is because I just typed my code on my phone that day!):

MktoForms2.whenReady(function(form){

  form.addHiddenFields{ lastReferrerURL: document.referrer }
});

Should be

MktoForms2.whenReady(function(form){

  form.addHiddenFields({ lastReferrerURL: document.referrer });
});