Lead Gen & CRM
How can we help you?
Search our help articles, video tutorials, and quickstart guides

You've got this. You've got us. Search our Knowledge Base to quickly find answers to your questions.

Capturing Page URLs with Form Submissions

Article: 000050301
Updated: July 18, 2024

Pass the URL of the page that your form was submitted on

Lead Gen & CRM allows you to pass the URL of the submission page containing a Lead Gen & CRM form into a custom field. This is helpful when you have a single Lead Gen & CRM form that is embedded on multiple pages of your website.

The URL can be used to trigger specific actions, add leads to lists, assign a campaign, and more.


Article Contents

 
Users:
Administrators 
Company Managers 
Marketing Managers 
Sales Managers  
Salespersons  
Jr. Salespersons  


Obtaining Custom Field IDs

Forms will need custom field IDs to be able to capture.

To obtain custom field IDs for form capture, do the following:

  1. Click Settings in the left toolbar.
  2. Click Custom Fields, located under Features in the left panel.
  3. Locate the custom field to include in the form and click  cog.png  Options > Copy fieldID to Clipboard to the right of the custom field.

    Copy fieldID to Clipboard

     



Configuring Forms

Your forms can be set to capture page URLs.

To create and configure a form to capture page URLs, create or edit the desired form:

  1. Click  12more.png  Actions > Embed Code.

    Form Embed Code
     
  2. Add var url = document.location.href; 
    below the <script type> tag in the embed code.
     
    Note: The var url code declares a variable that stores the page URL. The ss_form code sends that variable into a custom field in Lead Gen & CRM.
  3. Add ss_form.hidden = {'field_xXxXxXxXx': url}; above the </script> tag in the embed code. Paste the copied custom field's fieldID over the xXxXxXxX part of field_xXxXxXxX.
  4. Copy the edited form embed code.
  5. Click Close.

    Configure Form to Capture Page URL

     

Paste the edited embed code into your web page.

When the form is submitted, you will see the URL of the page within the custom field in Lead Gen & CRM.

Note: Constant Contact offers Professional Services to assist with custom coding.


Code Examples

The following is an example of form embed code prior to edits:

<!-- Lead Gen & CRM Form for URL -->
<script type="text/javascript">
    var ss_form = {'account': 'WzVzIKNeEPMzGiG', 'formID': 'CiLvIO12Z3MEGGLDWpIKcb33l3mBiESLiwbHDeiHKW8i3eiS'};
    ss_form.width = '100%';
    ss_form.domain = 'app-xx11xx11xx.marketingautomation.services';
</script>
<script type="text/javascript" src="https://koi-3QKH0X1U88.marketingautomation.services/client/form.js?ver=1.1.1"></script>


The following is an example of form embed code after edits:

<!-- Lead Gen & CRM Form for URL -->
<script type="text/javascript">
    var url = document.location.href; <!-- Line 1 -->
    var ss_form = {'account': 'WzVzIKNeEPMzGiG', 'formID': 'CiLvIO12Z3MEGGLDWpIKcb33l3mBiESLiwbHDeiHKW8i3eiS'};
    ss_form.width = '100%';
    ss_form.domain = 'app-xx11xx11xx.marketingautomation.services';
    ss_form.hidden = {'field_xXxXxXxXxX': url}; <!-- Line 2 -->
</script>
<script type="text/javascript" src="https://koi-3QKH0X1U88.marketingautomation.services/client/form.js?ver=1.1.1"></script>
 


Did this article answer your question?


Constant Contact Logo

Copyright © 2025 · All Rights Reserved · Constant Contact · Privacy Center