Tracking URLs on Wordpress pages using a global form

Anonymous
Not applicable

Tracking URLs on Wordpress pages using a global form

We are in the process moving to using Wordpress as our CMS. We are going to use a single global embedded Marketo form on each page of our Wordpress site. My goal is to be able to capture the specific URL of the page the person is when they fill out the form using a hidden field on the form called "Lead Source Details". I don't currently use UTM fields on those pages.

Here is a quick snapshot of how I would like this to go.

  • One Marketo form embedded on multiple Wodpress pages
  • John Doe fills out the form on www.assetworks.com/case-studies/city  --> His lead source details value is "www.assetworks.com/case-studies/city"
  • Jane Smith fill out that same embedded form on www.assetworks.com/contact us  --> Her lead source details value is "www.assetworks.com/contact us"

I have created the embedded form and know how to embed it into my Wordpress page.

Here is where I need help: If I don't have any UTMs set up on my pages and I just want to pull the full page URL (or page name if that's possible), what value do I type into the field "URL Parameter"?

url_parameter.JPG

Thank you so much! I have been reading all over the place and can't seem to figure this out on my own.

Tags (1)
3 REPLIES 3
SanfordWhiteman
Level 10 - Community Moderator

Re: Tracking URLs on Wordpress pages using a global form

First, to be very clear: www.assetworks.com/case-studies/city is not the URL the person is on because you're stripping off the http:// or https:// that makes a complete URL. 

Let's call the value you're talking about the "web page" rather than the "URL" to be proper. And in fact, this value is already part of the Filled Out Form activity so you can trigger/filter on it.

But if you want it to also be set as the value of the custom field Lead_Source_Details:

Do your usual:

MktoForms2.loadForm( ... );

then add

MktoForms2.whenReady(function(form){

     form.addHiddenValues({

          Lead_Source_Details : encodeURIComponent(document.location.href.replace(/^https?:\/\//,""))

     });

});

Justin_Norris1
Level 10 - Champion Alumni

Re: Tracking URLs on Wordpress pages using a global form

Carey Picklesimer

You can do this with a token trigger and a single global campaign, which is probably the easiest method.

SMART LIST

Fills Out Form

FLOW

Change Data Value - Lead Source Details - New Value = {{trigger.Web Page}}

Tokens for Interesting Moments - Marketo Docs - Product Docs

In practice I have found this to work for both Marketo landing pages and external sites as long as Munchkin is present. However test carefully to make sure this holds true for your environment.

Anonymous
Not applicable

Re: Tracking URLs on Wordpress pages using a global form

Thank you so much Justin! That is really helpful and i was able to test it. It works great! And the other links you shared with me are very helpful as well.