- Optimizely Web Experimentation
- Optimizely Performance Edge
- Optimizely Full Stack (Legacy)
Configure the Data and Attribution for Salesforce app
Before you follow these steps, you first have to install and authenticate the DNA app. Once installed and configured, the Optimizely Web Experimentation Data and Attribution for Salesforce app (DNA) runs in the background on its own. After you install DNA, configure it with the following process:
The Marketing operations team connects Optimizely Web Experimentation experiment visitor IDs to Salesforce records.
A Salesforce administrator displays the experiment history custom lightning component for leads and contacts.
A Salesforce system admin and an Optimizely Web Experimentation admin sends a conversion event to Optimizely Web Experimentation, map fields, and schedule data updates.
Contact Optimizely Support if you have any questions or file a support ticket.
Connect the visitor ID to a Lead or Contact
The Optimizely Web Experimentation DNA-managed package includes a new field, visitor_ID, on lead and contact records.
You need to pass the visitor ID to Salesforce to synchronize experiment data to the correct Salesforce record. If you use a marketing automation service like Marketo or Pardot to manage leads, you can create a hidden field to capture the Optimizely Web Experimentation visitor ID and pass it to Salesforce.
Attach the visitor ID to a hidden field
You can upload a hidden field with a CSV file or other marketing product that passes data from a web form to Salesforce records. You also can use Salesforce APIs to update records. Contact Optimizely support for advice on your best approach,
Marketo adds a hidden field without any code. See Set a Hidden Form Field in Marketeto documentation, and here are the steps you’ll need to take:
- Log into your Marketo account and open the form where the field will be added.
- Add a hidden field to the form.
Update the settings as follows:
- Default value – Leave blank.
- Get value from – Select Cookie Value from the drop-down menu.
Parameter name – Set as optimizelyEndUserId.
This is case sensitive so you must enter it exactly as it is written above.
- Click Save.
Salesforce Pardot users
Pardot lets you pass data as a hidden field. The details depend on how your page and form are configured. See Passing Hidden Fields to Account Engagement Forms in Salesforce documentation.
Oracle Eloqua users
Grant access to the visitor ID field
Select the users you want to have access to the visitor ID field. Proper access passes visitor ID field among Salesforce records.
- Open Salesforce Setup.
- Search for and open Object Manager.
- Open Lead in the Object Manager view, and click Fields & Relationships.
- Click visitor ID, then click Field-Level Security.
- Assign read or write access to Profiles by selecting boxes in the Visible column for Standard Users.
- Repeat this process for the Contact and Opportunity Objects.
Map visitor ID
Map visitor ID among Leads, Contacts, and Opportunities.
- Open Salesforce Setup.
- Search for and open Object Manager.
- Select Lead, click Fields & Relationships, then click Map Lead Fields.
- In the Custom Fields view, click the Contact tab, go to Visitor Id, click the adjacent picklist under the Account Fields column, and change the value from None to visitor Id.
Click the Opportunity tab and repeat steps 4 and 5.
See Guidelines for Mapping Custom Lead Fields for Lead Conversion in Salesforce documentation.
Configure experiment history
When you establish a data connection with Optimizely Web Experimentation and configure your visitor IDs, you can see the experiment history of Salesforce leads and contacts. The experiment history component also works on for Case pages if the Case is tied to a Contact via the standard lookup.
The Experiment History view is a Salesforce Lightning component that shows key details about the experiment and variations that a given lead or contact has experienced. This custom Lightning component is created automatically when you install the DNA app.
Your Salesforce admin can visit the Lightning App Builder and edit the pages that should include the experiment history list.
To include the experiment history list for a lead or contact:
- Open the lead or contact in the Lightning App Builder.
- Click the gear icon in the top right and choose to edit the page.
- Add Experiment History List.
- Save the updated view and activate.
Here’s an example of what the experiment history custom component looks like in a contact record page within Salesforce:
Click the experiment name to view experiment details and the variation name to view variation details:
Schedule Apex jobs to update data
Completing this step of configuration ensures your team has fresh experiment history data. Even if your team does not plan to display the Experiment History Lightning component to users, we recommend completing this configuration so that you can create valuable reports — for example, you can create a report that highlights the conversion rate from experimented leads to opportunities over time.
You can schedule Apex jobs via the Optimizely Web Experimentation app installation and settings manager, or via Salesforce's standard Apex job scheduler.
Schedule Apex jobs via Optimizely Web Experimentation's App (recommended)
Most teams will schedule Apex jobs related to this app via the "Schedule Jobs" tab during app installation. This is easier to configure and manage than using Salesforce's standard Apex job scheduler. To configure or modify Apex jobs using this easier method, please follow the instructions provided in the installation guide.
Schedule Apex jobs via Salesforce's standard scheduler
This alternate approach can be more time-consuming to implement and manage than using Optimizely Web Experimentation's app installation and settings manager. For example, if you wanted to schedule an Apex job to run each hour of the day to update Lead data, you would need to schedule 24 separate jobs via Salesforce's Standard Scheduler. In contrast, with Optimizely Web Experimentation's app, you can accomplish this same outcome in a few clicks.
However, Salesforce's standard scheduler can be a good solution if your team requires much more granular control. Below is a guide to taking this approach.
You will have to complete the following steps for each job you wish to run for both Leads and Contacts.
- Open Salesforce Setup.
- Search for and open, Apex Classes.
- Click the Schedule Apex button under the header of the Apex Classes view.
- Add a Job Name, e.g. Lead Experiment History Updates.
- Click the search icon adjacent to the Apex Class field, and then click LeadExperimentHistoryBatch in the window that display.
- Select your desired frequency settings.
- Click Save.
This process will arrange for a data update for Leads once per day. Repeat this process and modify the Preferred Start Time if you want to run more frequent updates.
Repeat this process to schedule updates for Contact History — to do so, select the Apex Class field, ContactExperimentHistoryBatch when completing step 5 above.
To learn more about scheduling Apex Jobs, please visit this Salesforce guide.
Additional Syncing Information
Each day, Optimizely Web Experimentation runs a scheduled batch job to link the experiment history associated with specific visitor IDs to any leads or contacts where a visitor ID has been added since the last batch update. Experiment history will only be pulled into Salesforce when the experiment type is A/B, Feature, or Other.
If there is already applicable experiment data in Salesforce, a new lead or contact visitor ID variation record will be created using the data Salesforce collects from this batch job. Otherwise, Salesforce creates the appropriate records at the variations, experiments, and/or projects levels.
Salesforce will append visitor ID variations and associated bucketing/experimentation data to the lead or contact visitor ID over the course of the next seven days. This is to capture any additional experiment history accumulated to the visitor ID after the initial bucketing event/experiment history.
This bucketing/experiment history data information will not be brought into Salesforce real-time. Instead, it is collected by a scheduled batch job that runs only once per hour.
Send a conversion event to Optimizely Web Experimentation
Imagine you want to experiment with different website signup forms. When a lead or contact reaches a critical milestone in Salesforce (e.g.,
Lead Status = “Working
- Contacted”), this Optimizely Web Experimentation event can now be transmitted to Optimizely Web Experimentation through the Process Builder. This added information can bolster the value of Optimizely Web Experimentation's analytics, adding richness and nuance to your experimental results.
App admins can set the criteria used by the Process Builder and configure the immediate action to map to the appropriate Optimizely Web Experimentation event.
You can use either Process Builder or native Apex code to communicate events to Optimizely Web Experimentation, and we share how to configure each option below.
Option 1: Send Conversion Event Using Process Builder
Salesforce’s Process Builder is a tool for building “if-then” conditions that tell Salesforce when to send events to Optimizely Web Experimentation, and what those events should be. For example, “If the status of a Salesforce lead associated with an Optimizely Web Experimentation experiment changes to ‘Market Qualified Lead,’ then share this event with Optimizely Web Experimentation.”
The DNA includes Process Builder templates that you can use to get started quickly.
To send a Salesforce event to Optimizely Web Experimentation:
- In Salesforce, navigate to Settings.
- Use the Salesforce Quick Find feature to search for and open Process Builder.
- Select one of the three Optimizely Web Experimentation Process Builder templates in the Salesforce list of My Processes:
- Contact Conversion
- Lead Conversion
- Opportunity Conversion
- Clone the template you selected in step 3 above. Alternatively, you can use the template as the basis for a new process you build yourself.
- In the process’ detail view, click the blue diamond to modify the process criteria in a way that maps placeholders (i.e., Replace Me) to your desired criteria (for example, set the Lead Status Salesforce field to Market Qualified Lead).
In other words, this step is where you define what must occur in order for Salesforce to pass an event to Optimizely Web Experimentation.
- Click Save.
- To configure the Process Builder’s Immediate Action, click the icon directly below Immediate Actions in Salesforce to configure it. This will permit Salesforce to pass an event directly to Optimizely Web Experimentation. If you choose to build a separate process or add a new node to an existing process rather than use the template, be sure to select Create a Record as the Action Type. Doing so will ensure you can set the Record Type as Conversion Event.
- Populate the fields Event Id and Event Key. To do this, select the applicable experiment from within Optimizely Web Experimentation.
- Within the Optimizely Web Experimentation Experiment view, click on API Names in the left-hand navigation.
- Locate the desired event, and use the appropriate ID/API Name pairing. Remember, the API name is what you’ll put in the Event Key field in Salesforce.
- In the Immediate Actions screen in the Process Builder, click Action under Immediate Actions. In the Create a Record fields on the right side of the screen, enter the event ID and the event key in the appropriate field.
- Click Save at the bottom of the settings view.
- Click Activate in the top right corner of the settings view.
Option 2: Send conversion event using Apex code
You can optionally use Apex to create the conversion event and publish it to the event bus.
The DNA app has a Conversion Event platform event. The platform event/invocable methods are global, so this means that the methods are accessible to write an Apex class against outside the app.
Please reference our Process Builder configuration documentation above to understand the Parameters the platform event will need. The Conversion Event takes four parameters:
- Visitor ID – Type (Text 255)
- Event ID – Type (Text 255)
- Event Key – Type (Text 64)
- Experiment ID – Type (Text 255)
Here is example code:
optimizely_dna__Conversion_Event__e e = new optimizely_dna__Conversion_Event__e();
e.optimizely_dna__Visitor_Id__c = 'your-visitor-id';
e.optimizely_dna__Event_Id__c = 'custom event id';
e.optimizely_dna__Event_Key__c = 'custom_event_key';
EventBus.publish(e); // event bus also supports lists
This is just an example of creating a single conversion event. To bulk up your code, you would need to utilize a list.
Create a Custom Event
To create a custom event, you’ll need to either select an existing custom event or create a new one tied to the Process Builder.
If the desired event does not exist, click Create New Event, select Custom, and fill in the fields. The new event displays in the event list, along with a unique ID. The event API name (aka Event Key) and event ID will be entered in Salesforce Process Builder.
View and create experiments
You can view and manage your experiments from within the Experiments tab in Optimizely Web Experimentation.
After configuring the custom event (potential_revenue, aka “Opportunity Creation”) in both Optimizely Web Experimentation and Salesforce Process Builder, set this event as the primary metric in a new experiment.
The metrics defined for a given experiment are accessible by clicking the experiment name in the experiment list, then clicking Metrics.
View experiment results by clicking Results on the right side of the Experiments screen:
Or from within the experiment detail view:
Optimizely Web Experimentation provides results for each variation and metric. Here is an example of what the Campaign Results page might look like:
Reports and Dashboards
Your team can gain additional value from the DNA app by creating custom reports that build on the experiment data linked to your leads and contacts.
For example, you could create a report for the leads or contacts in your experiment campaigns and re-target those records via email, or upload them with a CSV or TSV file into your Dynamic Customer Profiles (DCP).
You could also create a dashboard detailing how experimentation affects the success of your lead and opportunity pipeline:
By default, 10 visitor ID records are included per batch update. Increasing this limit can reduce the volume of API calls and enable updates to run faster; however, increasing the limit may also result in exceeding Salesforce limits. Salesforce has a callout limit of 100. You can roughly calculate total callouts as follows:
The total callouts equal the sum of the following:
- # of visitor IDs in the batch (batch size).
- 1 callout for each active Project returned in the above.
- 1 callout for each of the active Experiments and Campaigns across all Projects.
- 1 additional callout for each active Campaign across all Projects.
As an example, for 1 project with 15 campaigns and 15 experiments with batch size 10, you would see 56 callouts: 10 callouts to Optimizely Web Experimentation's Attribution API, 1 callout to Optimizely Web Experimentation's Project API, 30 callouts to Optimizely Web Experimentation's Experiments API, and 15 callouts to Optimizely Web Experimentation's Campaigns API
If you exceed you exceed the Salesforce governor limit for API callouts, Salesforce will log an error in the standard Salesforce Apex Job screen with the text "too many callouts" (example below).
Modify Batch Update Size
- Open Salesforce Setup
- Search for and select Custom Settings
- Open Optimizely Settings
- Click the Manage button
- Click Edit
- Enter a new value in the Batch Size field
- Click Save
The Custom Logging feature is controlled by an administrator. Optimizely Web Experimentation logs errors to a custom object via a platform event, and an administrator can enable or disable logging, and specify how many records are to be deleted.
By default Optimizely Web Experimentation keeps the 1,000 most recent errors logged, and prunes errors in excess of this limit. To modify the max number of logs, navigate to Setup > Custom Metadata Types > LogScience. You can optionally disable pruning, or modify the max number of logs.
If you would like to disable app error logging, navigate to Setup > Custom Metadata Types > Manage LogScience records and set the Enable Logging toggle to False.
Validate data and Attribution App Setup success
Below are options for validating that your setup of the DNA app is successful. Before proceeding with validation, please ensure you have followed all instructions in the DNA installation and configuration guide above. Also, we recommend creating an AA experiment tied to a website lead form to facilitate the validation steps below.
1. Validate one-time successful communication of record experiment history and Salesforce event communication
Approach: confirm that DNA communication works for a single lead
Part A: Confirm Record Update
- Submit a dummy lead through a web form where an Optimizely Web Experimentation experiment is running, and where Visitor ID is configured to be passed to Salesforce upon lead form submission.
- Visit the Optimizely Web Experimentation app in Salesforce, and open Schedule Jobs in the App setup (under the Optimizely App tab).
- Click Run Now under the jobs scheduler for Leads.
- Open the Lead record associated with the dummy lead.
- Ensure that the Experiment History Lightning Web Component has been added to the Lead page layout — you can optionally arrange for this to only appear for yourself (an admin) for evaluation purposes.
- Confirm whether Experiment History includes a new line item for the dummy lead, representing that the dummy lead was bucketed into that experiment.
- Click on the experiment in the list, and identify which Variation the lead experienced.
Part B: Confirm Event Communication
- Visit your AA Experiment in your dashboard at Optimizely.com
- Confirm whether the count of lead submissions increases by 1 for the variation the lead experienced
2. Validate ongoing successful communication of experiment history from website forms to Salesforce records
Approach: confirm that the count of newly created Salesforce Leads that were bucketed into an experiment (assigned a Visitor ID) aligns with the count of lead submissions in the associated Optimizely Web Experimentation experiment
- Create an AA Experiment in Optimizely Web Experimentation, or use an existing experiment, that tracks total lead submissions from a given webform.
- Create a Salesforce report for Experimented Leads
- Ensure you can see a breakdown of Leads that have and have not been assigned a Visitor ID
- If possible, also include a field indicating the source of the lead (for example, Landing Page Lead Form).
- Go to Setup and create a new Report Type for Optimizely Web Experimentation objects
- Create three reports:
- Leads grouped by Variation Experiment Name
- Leads grouped by Converted or Not by Experiment Name/Variation
- Create a Dashboard and assemble these three reports into a single dashboard showing the different metrics.
- Compare total experimented Leads in Salesforce with total lead submissions in Optimizely Web Experimentation for a given time frame and ensure the totals are roughly similar.
3. Validate ongoing successful communication of Salesforce events to Optimizely Web Experimentation
Approach: confirm that the count of Market Qualified Leads with a Visitor ID aligns with the count of MQLs communicated to Optimizely Web Experimentation via Salesforce Process Builder
- Create an AA Experiment in Optimizely Web Experimentation, or use an existing experiment, that tracks total lead submissions from a given webform. Ensure that the experiment includes a metric tied to a custom event that will be linked to Salesforce Process Builder.
- Create a Salesforce report for experimented MQLS
- Ensure you can see a breakdown of MQLs that have and have not been assigned a Visitor ID
- To create reports, ensure that the steps above have been completed for a custom report type and report showing Leads experimentations
- Clone that report but add a grouping for the field that indicates MQL if applicable for your customer.
- Clone that first report again and group by whether
- Ensure Process Builder is properly configured to communicate with Optimizely Web Experimentation when an experimented Lead converts to a MQL, and that a corresponding Optimizely Web Experimentation custom event has been attached to an experiment for at least as long as the time frame you plan to use for the value comparison.
- Compare total experimented MQLs in Salesforce with total MQLs reported in Optimizely Web Experimentation for a given time frame and ensure the totals are roughly similar.