This demonstrates how to use S4S Cloud Send2CRM to identify a website visitor against an existing Lead. In this example we send out an email to Leads that already exist in Salesforce, but are not yet identified as S4S Cloud visitors.Send2CRM visitors.
This is also an alternative to the built-in visitor id URL parameter for identifying visitors across different browsers and devices.
URL parameters
The individual link may be something like:
https://example.com/clickthrough?leadid=00Q5g000007FikMAAS
Note |
---|
If you You probably don’t want to expose the actual Lead Id, use a custom external Id or some other unique field such as a hash. |
Info |
---|
This example uses a Lead, but it could be any other standard or custom object. See Custom Identification Object for more details. |
Create Mapping
Create an S4S Cloud a Send2CRM Mapping in Salesforce.
Set the Form Identifier to
formId:<custom_id_here>
.Set the Salesforce Object to Lead.
Check the Update Only box.
Set the Identification Lookup to Lead.
...
Set Salesforce field to Lead ID.
Set Form field field to use the Data accessor
leadid
.Set Inbound Mapping to Identity Matching key.
...
Info |
---|
This mapping will identify a visitor any time it finds an existing Lead matched by the passed leadid value. It will never create a Lead. |
...
Add script to the website to take the value from the URL parameter and submit it via S4S CloudSend2CRM.
Code Block | ||
---|---|---|
| ||
// Do not act until the document is loaded. window.addEventListener('load', (evt) => { // Get the leadid parameter from the URL. let urlParams = new URLSearchParams(window.local.search); if (urlParams.has('leadid')) { // Create object with field values - this should match the data accessor in the mapping. let formData = { leadid: urlParams.get('leadid') }; // Send the form data via S4S CloudSend2CRM, using the formId that matches the mapping. S4SCloudsend2crm.forms.send('lead_identifier', formData) .then((data) => { // Successful response. S4S CloudSend2CRM will apply the visitor id automatically. // Show a success message, or do something else. }) .catch((error) => { // Failed :-( // Perhaps surface an error? }); } } |
...