1.Intended Audience
This document will guide you through integrating a WordPress / GravityForms website with the MyMedLeads Web API. The document will describe the different properties/attributes of a Lead and how to populate this and send to MyMedLeads.
Intended Audience
This document is outlined for a WordPress Web Developer. This document assumes that you do know PHP and that you currently managing the website. Websites built using WordPress are very easy to integrate with MyMedLeads. The MyMedLeads team can provide your organization with installable plugins to facilitate this integration. Your Web Team simply needs to install it. Once the plugin is installed and activated, your website will be integrated moving forward.
Requirements
You will need a few things from our team to get started. We have a zip file that contains some necessary .php files to power the integration. Further, it will be required for you to have some data from MyMedLeads
- Transaction Key – your team will need a Transaction Key or Keys. Each TransactionKey identifies a single LeadSource, and it is possible for a single site to have forms that have different LeadSources (ex: landing pages).
- Procedure ID Data – your team may need a list of Procedure IDs from our system if ProcedureOfInterest is captured on the web site and its forms.
The plugins are customized for each website and specific form. If there are significant changes or new forms added to the website, it is important to reach out to our team so we can properly update the plugin to accommodate the new forms.
Integrated Form Builders:
– Contact Form 7
– Gravity Forms
– Ninja Forms
– WP Forms
There are a few lesser-known form builders that also integrate with MyMedLeads. However, we do not support purchased themes that come with forms. These types of forms typically require updates to the functions.php file, which is neither preferred nor reliable.
2.Integration Overview
The MyMedLeads Team has produced an installable Plugin to help integrate GravityForms with MyMedLeads. Your team may need to request the starter project/plugin, however normally the MyMedLeads Team will write and update the Plugin as a courtesy.
The internal logic of the MyMedLeads GravityForms Plugin, is based solely on the PHP Integration Code. Below is a link that navigates you to the PHP Integration Overview and you are able to use 100% of the logic and strategy there to integrate the site. You are required to inject the produced logic into the MyMedLeads GravityForms Plugin.
Plugin Structure
When your team first opens up the file: mml_gf.php (found within the provided zip code), they will notice a large comment header, followed by a few lines of logic that leads into a switch() statement. This switch statement helps identifies what form is being processed and allows you to place Form-specific logic in each case statement.
Example:
case '1' : // ContactUs
$mml = new MMLClient('TransactionKey');
$mml->parseGravityFormForFullName($entry, '1');
$mml->addValue($entry['4'], MML_PARAM_PHONE2);
$mml->addValue($entry['2'], MML_PARAM_EMAILADDRESS);
$procId = getProcedureId( $entry['3']);
if ($procId > 0)
{
$mml->addValue($procId, MML_PARAM_PROCEDUREDATA);
}
$mml->addValue($entry['3'], MML_PARAM_COMMENTS);
$mml->PostLead();
break;
As you can see above you are simply accessing an $entry item looking for different values, using the Field ID. Below we describe how to find the Form IDs and individual Field IDs.
As with all PHP Web Site Integrations, your team can produce a getProcedureId() function to assist with mapping MyMedLeads IDs to the ProcedureOfInterest fields’ selections. (you can find direct examples in the Web Site Integration – PHP documentation, linked above)
Example:
function getProcedureId($procName) {
$procedureArray = array(
'botox' => '22',
'brow lift' => '1',
'rhinoplasty' => '5'
);
if ($procName != '')
{
$procName = strtolower($procName);
foreach ($procedureArray as $term => $pId) {
if (strpos($procName, $term) !== false){
return $pId;
}
}
}
return 0; // other procedure
}
There are additional functions within the mmlclient.php (found within the shared zip file), that are specific to GravityForms and helps locate and apply values from custom form components (EX: Full Name). You can find this information in the GravityForm Functions section.
3.GravityForms Functions
Within the mmlclient.php there are a few functions that are meant to make it easier to pull data from GravityForms. Below we outline those and their uses.
parseGravityFormForAddress()
This function parses the Address Component of GravityForms. It captures all of the significant data and places it in the applicable fields. The Country does go into the comments currently.
$entry – this parameter is supplied by GravityForms
$entryid – the ID of the field (please see below)
parseGravityFormForFullName()
This function parses the FullName Component of GravityForms. It captures all of the significant data and places it in the applicable fields. The name is split on the first space within the name.
$entry – this parameter is supplied by GravityForms
$entryid – the ID of the field (please see below)
4.GravityForm Data Collection
This section will walk you through collecting Form and Field IDs for GravityForm integrations. This information is necessary to help identify what Form we are processing and what fields map to FirstName, LastName, etc. Within GravityForms there are two ways to capture this data. The first is to log into WordPress and collect the data there (very easy). The second way is to navigate to the public site and locate the forms within the web site. From there you view the source or view HTML and you can find the IDs.
Form IDs
You will need to login to the WordPress site and within the left hand menu you should see a Forms link. Click that link, to expand a sub menu. Within that sub menu there will be another link called Forms, click that link. Below is an image that shows where to locate the Form IDs:

To grab the same IDs from the HTML, you simply navigate to a page that has the form rendering on it. Right click and select “View Source” or “View HTML”. Within the HTML find the form’s HTML and look at the ID, there will be a number next to the ‘gform_’. This is the Form’s ID. See below:

Field IDs
To collect the Field IDs is similar to how you collect the FormIds. There are still two ways and we will start with the WordPress Administration method of collecting this data.
Click on the form name from the list to go into the Form Editor. Once in the Form Editor area, you can hover over each field to see the Field ID. Please take note of each ID and what field it maps to. Below is an image that demonstrates where to find this information:

To grab the same IDs from the HTML, you simply navigate to a page that has the form rendering on it. Right click and select “View Source” or “View HTML”. Within the HTML find the form’s HTML and you will need to “Inspect” each field looking for the following information:

5.Uninstalling the Plugin
While you should not need to uninstall the Plugin at anytime, there maybe times when you are migrating to a new FormBuilder within WordPress or other reasons that may require you to uninstall the Plugin. The below instructions walks you through those steps.
- While logged into WordPress, within the Sidebar menu locate “Plugins”, and select “Installed Plugin” (see diagram 1.1)
- Within the List, locate the Plugin named “GravityForms MyMedLeads Lead Tracking” and press Deactivate.
- Once deactivated you will want to locate the same Plugin “GravityForms MyMedLeads Lead Tracking” and then press Delete. (see diagram 1.2)
- A popup will render asking you to confirm, click OK


