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

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


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-**", "***-***-***", 148,



        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 :


MktoForms2.whenReady(function (form) {

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