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.

Submitting Directly to Native Form Endpoints

Article: 000050407
Updated: July 26, 2024

Learn how to submit data to the endpoint of a native form without the use of embed code

Sometimes, it can be useful to submit data directly to the endpoint of a native form. This allows a form to be submitted to Lead Gen & CRM without use of the native form embed code.

Instead, a developer will need to create code to build a URL containing the form data, and post that URL to Lead Gen & CRM.

This article will detail how to submit directly to native forms.


Article Contents


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


Understanding Direct Submission

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

However, as this integration is not standard and not an official capability of the Lead Gen & CRM platform, Lead Gen & CRM Support will not help to debug faulty code.

Submitting directly to native form endpoints allows your developer complete control over when form data is submitted to Lead Gen & CRM. This also allows you to further manipulate the data with your own code before posting it.

For some forms, due to the way they are constructed or their method of submission, this method may be the only one available. Using this method, the data does not even need to come from an actual form, but can be pulled from any source your developer has access to.

A form’s endpoint will have the following structure: 
 

https://app-XXXXXXXX.marketingautomation.services/webforms/receivePostback/YYYYYYYYYYYY/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/jsonp/


With example data appended, it would look like the following:
 

https://app-XXXXXXXX.marketingautomation.services/webforms/receivePostback/YYYYYYYYYYYY/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/jsonp/?firstName=First&lastName=Last&email=first.last@constantcontact.com


To find your form’s endpoint, create a native form in Lead Gen & CRM and view its embed code.  
 

<script type="text/javascript">
    var __ss_noform = __ss_noform || [];
    __ss_noform.push(['baseURI', 'https://app-XXXXXXXXXX.marketingautomation.services/webforms/receivePostback/MzYwN7EwMzcyAgA/']);
    __ss_noform.push(['endpoint', '30e3bbfe-a5e7-4207-9237-e9f9e2ff80e9']);
</script>
<script type="text/javascript" src="https://koi-XXXXXXXXXX.marketingautomation.services/client/noform.js?ver=1.24" ></script>


Your form’s endpoint will be the URL on the line containing ‘baseURI’, plus the value following ‘endpoint’. It will then end with /jsonp/. Consider the following values for the example code:
 

Part Code
baseURI


 
https://app-XXXXXXXXXX.marketingautomation.services/
webforms/receivePostback/MzYwN7EwMzcyAgA/
endpoint


 
30e3bbfe-a5e7-4207-9237-e9f9e2ff80e9
endpoint URL


 
https://app-XXXXXXXXXX.marketingautomation.services/
webforms/receivePostback/MzYwN7EwMzcyAgA/
30e3bbfe-a5e7-4207-9237-e9f9e2ff80e9/jsonp/
 


Field names can be whatever you like, as long as they are unique and consistent on every submission. You will map these fields just as you would map fields with any native form, so the incoming field names should be descriptive to make the mapping easier. Avoid using punctuation in the field names as well, as it could cause a submission error.
 



Establishing Tracking

Consider the following example code of a submission to this endpoint with the first name First, the last name Last, and the email address First.Last@constantcontact.com. 

While this code would collect form data and create leads, it would not establish tracking on the lead as a form submission normally would.
 

https://app-XXXXXXXXXX.marketingautomation.services/webforms/receivePostback/MzYwN7EwMzcyAgA/30e3bbfe-a5e7-4207-9237-e9f9e2ff80e9/jsonp/?firstName=First&LastName=Last&Email=First.Last@constantcontact.com

In order to establish tracking, you must gather the cookie and pass it in a field called trackingid__sb. This field has two underscores, will not appear on the field mapping page, and must always have this name.

You can retrieve the cookie called __ss_tk and pass that as the tracking ID value. If this is done, the form will establish tracking on the lead just as any native form would. The cookie can also be obtained using dynamic web content, but most often a developer will fetch the cookie with their own code. Tracking cookies should have a format similar to the following: 
201611|581a09d2ba899bcc078b477a

https://app-3Q7ZHNRIA0.marketingautomation.services/webforms/receivePostback/MzYwN7EwMzcyAgA/30e3bbfe-a5e7-4207-9237-e9f9e2ff80e9/jsonp/?firstName=First&LastName=Last&Email=First.Last@constantcontact.com&trackingid__sb=201611|581a09d2ba899bcc078b477a
Note: Submissions to native form endpoints from your own code should come from your back end. Making the HTTP request from the front end will likely result in CORS errors due to cross-site scripting.


With the addition of this cookie, the example code would look like the supplied example tracking code. This can be accomplished in any language in which you can construct a URL and submit it as a GET request. As such, the URL can be typed directly into the browser URL bar for testing, and the submission should come through.

Consider the supplied example code of tracking in PHP using cURL. While this is the most common method, the same logic would apply in any language.
 

$baseURL = "https://app-XXXXXXXX.constantcontact.com/webforms/receivePostback/XXXXXXXXXXXX/";
	$endPoint = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX";

        // Prepare parameters 
	$params = "";
	if (!empty($first_name)) {
		$params = $params . "FirstName=" . urlencode($first_name) . "&";
	}

	if (!empty($last_name)) {
		$params = $params . "LastName=" . urlencode($last_name) . "&";
	}

	if (!empty($email)) {
		$params = $params . "emailAddress=" . urlencode($email) . "&";
	}

	if (!empty($company)) {
		$params = $params . "Company=" . urlencode($company) . "&";
	}

	if (!empty($keep_me_updated)) {
		$params = $params . "Subscribe=" . urlencode($keep_me_updated) . "&";
	}

	if (isset($_COOKIE['__ss_tk'])) {
		$trackingid__sb = $_COOKIE['__ss_tk'];
		$params = $params . "trackingid__sb=" . urlencode($trackingid__sb);
	}

        // Prepare URL
	$ssRequest = $baseURL . $endPoint . "/jsonp/?" . $params;

        // Send request
	$ch = curl_init();
	curl_setopt($ch, CURLOPT_URL, $ssRequest); 
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	$result = curl_exec($ch);
	curl_close($ch);
 


Did this article answer your question?


Constant Contact Logo

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