Email click-through

Outgoing email

When sending email messages to recipients who are known Send2CRM visitors, add a couple of parameters to your website links:

  • s2cid: the web id of the visitor, i.e. the UUID value of the send2crm__s2cVisitor.send2crm__Web_Id__c in Salesforce. This will ensure that the visitor is correctly identified even if they use a different web browser.

Be careful when distributing links with the s2cid parameter, this will cause incorrect identification if used by someone other than the target visitor.

  • cts: (click-through subject). This could be any parameter name you choose, and contain any short relevant information. This example uses the email subject so you can later identify which email resulted in a click-through to the website. You could also use one of the standard UTM parameters.

An example URL might look something like this:

https://example.com/info?s2cid=1234abcd-1234-abcd-1234-abcd1234abcd&cts=Info%20mailer

Website click-through parameter

Send2CRM will automatically handle visitor identification via the s2cid parameter.

Add a custom visitor event to record the click-through when the cts parameter is present:

// Name of the click-through URL parameter. const CLICKTHROUGH_SUBJECT = 'cts'; // Name for the click-through custom event. const CLICKTHROUGH_EVENT = 'CLICKTHROUGH'; window.addEventListener('load', (evt) => { // Get the click-through custom parameter from the URL. let urlParams = new URLSearchParams(window.location.search); if (urlParams.has(CLICKTHROUGH_SUBJECT)) { // Optional; get the URL of the current page without the parameters for recording with the event. let urlWithoutParams = window.location.protocol + '//' + window.location.host + window.location.pathname; // Record a custom session event. send2crm.analytics?.setCustomEvent(CLICKTHROUGH_EVENT, { // Subject from URL parameter. subject: urlParams.get(CLICKTHROUGH_SUBJECT), // URL without parameters (we don't want to accidentally identify as this visitor or cause another event). url: urlWithoutParams, // Add current UTM parameters, if any. utm: send2crm.util.getUtmParams(), }); } });

This code can also be used without the s2cid parameter for anonymous visitors. The event will be recorded in the user’s web browser, and later pushed to the service if an identifying form is completed.

The example above includes UTM parameters too. Send2CRM needs to be configured to record these, or you could substitute from another source if you have something else in place.

Consume custom event

Raising the custom event above means it will be sent to the Send2CRM service for identified visitors. Send2CRM will record Session and Visitor statistics about the event out of the box; it will also record event details against the Session if you have the Store Event Data setting enabled.

There are some additional things you could do with this event: