How to create a field that grabs the web page the form was filled out on | Community
Skip to main content
KCS_Integration
Level 2
March 30, 2018

How to create a field that grabs the web page the form was filled out on

  • March 30, 2018
  • 2 replies
  • 1876 views

Issue Description
You want to create a field that will grab the web page the form was filled out on and add this as a token in an alert that goes to sales when a form is filled out.

Issue Resolution
This can be achieved either through a Smart Campaign or the JS API code. The code is more efficient because it doesn't mean another trigger is active in your instance.

Smart campaign:

You'll want to create a smart campaign with

Smart List - Fills Out Form

and

Flow - Change Data Value, [your field name], New Attribute is {{trigger.Web Page}}

You would need to reference the trigger token in the alert email so the team knows what product page the end user filled out the form on.

Code: (Embedded Form)

This can be done with a hidden field.

MktoForms2.loadForm("//app-**01.marketo.com", "***-***-***", 148,

    function(form)

    {

        form.addHiddenFields({ LastFormURL : document.location.href })   

    });

The asterisks represent your company's Marketo data (your Munchkin ID and Marketo instance). Your developer will know what to do if s/he is already using the embed code.

Code: (Marketo LP)

In a Marketo LP, you will have to edit the template and put this at the end, before the </body> tag :


<script>

MktoForms2.whenReady(function (form) {

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

});

</script>

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

2 replies

Andrew_Linn1
February 1, 2019

Hi! I'm new to Marketo (Coming from Eloqua)

I inserted to code for the Marketo LP, and it appears to see the URL and insert into a hidden field. But it's not the field I created on the form that it is inserting it into.

See here:

I have the field set to grab from Cookie, and URL parameter is: LastFormURL

Any idea why it's not populating in my hidden field in the form? URL: https://go.kibocommerce.com/hidden_Field_Test.html

Roxann_McGlump1
Level 5
February 5, 2019

Hi Andrew,

I'm not a web developer so I don't have the ability to read or troubleshoot code.  If you don't have a web developer to help you out, you might try reaching out on the community to see if someone can give you some help with this.