Usage
.crm-column_name
Parameters
column_name
(Required) (String) The name of the column to add the input value to
Default: None
Parameter Notes
This function looks for form [class*="crm-"]
which is any input field in a form with a class that begins with “crm-“. The string after the “crm-” in the class name will be used as the column name in the crm() send, the value of the input field will be used as the cell data.
Examples
<input class="crm-first_name" type="text" placeholder="Enter your first name..." />
Additional Notes
This function is automatically triggered on wpcf7:submit
so all forms using Contact Form 7.
Source File
Located in /assets/js/modules/analytics.js on line 1624.
No Hooks
This function does not have any filters or actions available. Request one?nebula.crmForm = async function(formID){ let crmFormObj = {}; if ( formID ){ crmFormObj.form_contacted = 'CF7 (' + formID + ') Submit Attempt'; //This is triggered on submission attempt, so it may capture abandoned forms due to validation errors. } jQuery('form [class*="crm-"]').each(function(){ if ( jQuery(this).val().trim().length ){ if ( jQuery(this).attr('class').includes('crm-notable_poi') ){ setDimension('notable_poi', jQuery('.notable-poi').val()); } let cat = (/crm-([a-z\_]+)/g).exec(jQuery(this).attr('class')); if ( cat ){ let thisCat = cat[1]; crmFormObj[thisCat] = jQuery(this).val(); } } }); if ( Object.keys(crmFormObj).length ){ nebula.crm('identify', crmFormObj); } };
Override
To override or disable this JavaScript function, simply redeclare it with the exact same function name. Remember: Some functionality is conditionally loaded via dynamic imports, so if your function is not overriding properly, try listening for a DOM event (described below).
For non-module import functions:
nebula.crmForm = function(column_name){ //Write your own code here, leave it blank, or return false. }
For dynamically imported module function overrides:
jQuery(window).on('load', function(){ nebula.crmForm = function(column_name){ //Write your own code here, leave it blank, or return false. } });
Custom Nebula DOM events do also exist, so you could also try the following if the Window Load listener does not work:
jQuery(document).on('nebula_module_loaded', function(module){ //Note that the module variable is also available to know which module specifically was imported if ( typeof nebula.crmForm === 'function' ){ nebula.crmForm = function(column_name){ //Write your own code here, leave it blank, or return false. } } });