Skip to main content

JavaScript Functions

AuroraLeadCaptureAsyncInit

Lead Capture AI can also be configured through the AuroraLeadCapture namespace. In order to use these functions, they must be called from within this function.

window.AuroraLeadCaptureAsyncInit = () => {
// Use AuroraLeadCapture within this function
};

AuroraLeadCapture

addEventListener

Provide a callback function that will be called based on the event sent by Lead Capture AI. Allows multiple event listeners on the same event via multiple calls.

Usage

AuroraLeadCapture.addEventListener(event, callback);

Parameters

parametertypenote
event
(required)
stringDetailed below in Event Types
callback
(required)
functionFunction to be called when the specified event occurs

Returns

Void

Event Types

Passthrough Attributes

The Lead Capture SDK will pass through common marketing URL parameters from the host page via JavaScript events. This is intended to enable campaign attribution tracking when leads are converted through Lead Capture AI. The parameters are sent in the referrerParams property on all JavaScript events.

The referrerParams property is an object that may contain any of the following properties:

nametypeMatching URL Parameter
utmSourcestringutm_source
utmMediumstringutm_medium
utmCampaignstringutm_campaign
utmTermstringutm_term
utmContentstringutm_content
fbclidstringfbclid
gclidstringgclid

A property will only be present if it was on the host page where Lead Capture AI ran.

contact

Use this to get lead contact information from Lead Capture AI. This event will be sent when:

  • Contact information is submitted

This will only be sent a single time and does not contain any solar model data.

const contactCallback = (contact) => {
console.log(contact);
};

AuroraLeadCapture.addEventListener('contact', contactCallback);

The contact object will contain the following properties:

nametypenote
addressstringFull address, standardized according to google
averageMonthlyBillnumberWhat the user entered as their average monthly bill in dollars
citystringCity of the address
countrystringCountry of the address
emailstringEmail entered by the user
firstNamestringFirst name entered by the user
lastNamestringLast name entered by the user
latitudenumberLatitude of the address
longitudenumberLongitude of the address
orgIdstringOrganization ID
phonestringPhone number entered by the user
postalCodestringPostal code of the address
projectIdstringID of the project
referrerParamsobjectSee Passthrough Attributes for additional information
statestringState of the address
streetstringStreet of the address
streetNumberstringStreet number of the address

lead

Use this to get lead contact information and solar model data together from Lead Capture AI. This event will be sent when:

  • Contact information is submitted
  • Results page is displayed (if contact information has previously been submitted)
  • Error page is displayed (if contact information has previously been submitted)

This will be sent multiple times and should be used by searching for a record to update based on the projectId and creating a new record if one is not found. Be sure to account for these multiple events in your application or integration logic.

const leadCallback = (lead) => {
console.log(lead);
};

AuroraLeadCapture.addEventListener('lead', leadCallback);

The lead object will contain the following properties:

nametypenote
addressstringFull address, standardized according to google
annualProductionnumberTotal kWh produced in a year(1,2)
averageMonthlyBillnumberWhat the user entered as their average monthly bill in dollars
citystringCity of the address
countrystringCountry of the address
emailstringEmail entered by the user
errorbooleantrue if Lead Capture fails to generate a solar model(2)
firstNamestringFirst name entered by the user
lastNamestringLast name entered by the user
latitudenumberLatitude of the address
longitudenumberLongitude of the address
moduleCountnumberNumber of solar panels displayed to the user on the solar model(1,2)
monthlyOffsetnumbermonthlySavings divided by averageMonthlyBill as a percent(1,2)
monthlySavingsnumberEstimated monthly savings (cannot be larger than the averageMonthlyBill) in dollars(1,2)
orgIdstringOrganization ID
phonestringPhone number entered by the user
postalCodestringPostal code of the address
projectIdstringID of the project
referrerParamsobjectSee Passthrough Attributes for additional information
statestringState of the address
streetstringStreet of the address
streetNumberstringStreet number of the address
sunlightHoursnumberHours of usable sunlight as displayed to the user(1,2)
systemSizenumberTotal kW of the suggested design(1,2)
1 Not present if an error occurred.
2 Not present when contact information is submitted and the template is configured to have the lead contact form before the results.

results

Use this to get solar model information from Lead Capture AI. This event will be sent when:

  • Results page is displayed
  • Error page is displayed
const resultsCallback = (results) => {
console.log(results);
};

AuroraLeadCapture.addEventListener('results', resultsCallback);

The results object will contain the following properties:

nametypenote
addressstringFull address, standardized according to google
annualProductionnumberTotal kWh produced in a year(1)
averageMonthlyBillnumberWhat the user entered as their average monthly bill in dollars
citystringCity of the address
countrystringCountry of the address
errorbooleantrue if Lead Capture fails to generate a solar model
latitudenumberLatitude of the address
longitudenumberLongitude of the address
moduleCountnumberNumber of solar panels displayed to the user on the solar model(1)
monthlyOffsetnumbermonthlySavings divided by averageMonthlyBill as a percent(1)
monthlySavingsnumberEstimated monthly savings (cannot be larger than the averageMonthlyBill) in dollars(1)
orgIdstringOrganization ID
postalCodestringPostal code of the address
projectIdstringID of the project
referrerParamsobjectSee Passthrough Attributes for additional information
statestringState of the address
streetstringStreet of the address
streetNumberstringStreet number of the address
sunlightHoursnumberHours of usable sunlight as displayed to the user(1)
systemSizenumberTotal kW of the suggested design(1)
1 Not present if an error occurred.

open

Opens the Lead Capture Experience.

Usage

AuroraLeadCapture.open();

Returns

Void

setupCtas

Attaches a click event listener that will trigger AuroraLeadCapture.open() to any DOM elements found matching the provided selector.

Usage

AuroraLeadCapture.setupCtas(selector);

Parameters

parametertypenote
selector
(required)
stringA selector to be used in querySelectorAll such as #selector or .selector

Returns

Void