# Optimizely Feature Experimentation Cloud Mode Integration

<p>RudderStack lets you send your web experimentation data to Optimizely Feature Experimentation via <a href="https://www.rudderstack.com/docs/destinations/rudderstack-connection-modes/#cloud-mode" >cloud mode</a>.</p>
<p>Find the open source transformer code for this destination in the <a href="https://github.com/rudderlabs/rudder-transformer/tree/main/src/v0/destinations/" >GitHub repository</a>.</p>
<!-- end-chunk -->
<!-- begin-chunk -->
<h2 id="identify">Identify</h2><p>You can use the <a href="https://www.rudderstack.com/docs/event-spec/standard-events/identify/" ><code>identify</code></a> call to send decision events to Optimizely using their <a href="https://docs.developers.optimizely.com/experimentation-data/reference/post_events" >Event API</a> and activating the user for an experiment variation.</p>

<blockquote class="warning">
  <div class="tip-quote">
    
    <div class="tip-text"><p>Note that:</p>
<ul>
<li>You must call <code>identify</code> before the <code>track</code>/<code>page</code>/<code>screen</code> calls.</li>
<li>Make sure to pass the same <code>userId</code> that you are passing in the <code>identify</code> call to all other calls (<code>track</code>/ <code>page</code>/<code>screen</code>).</li>
</ul></div>
  </div>
</blockquote>
<p>A sample <code>identify</code> call sent to Optimizely:</p>
<div class="rs-code">
  <div class="rs-code__head">javascript<button class="rs-code__copy" type="button">
      
      Copy
    </button>
  </div>
  <div class="highlight"><pre class="chroma"><code class="language-javascript" data-lang="javascript">rudderanalytics.identify(&#34;1hKOmRA4GRlm&#34;, {
  firstName: &#34;Alex&#34;,
  lastName: &#34;Keener&#34;,
});</code></pre></div>
</div>
<p>To send <code>campaignId</code>, <code>experimentId</code>, and <code>variationId</code> in your <code>identify</code> events, use the <code>integrations</code> object in your calls:</p>
<div class="rs-code">
  <div class="rs-code__head">javascript<button class="rs-code__copy" type="button">
      
      Copy
    </button>
  </div>
  <div class="highlight"><pre class="chroma"><code class="language-javascript" data-lang="javascript">rudderanalytics.identify(&#34;1hKOmRA4GRlm&#34;, {
  firstName: &#34;Alex&#34;,
  lastName: &#34;Keener&#34;,
  integrations: {
    Optimizely Fullstack: {
      campaignId: &#34;&lt;campaign_id&gt;&#34;;
      experimentId: &#34;&lt;experiment_id&gt;&#34;;
      variationId: &#34;&lt;variation_id&gt;&#34;;
    }
  }
});</code></pre></div>
</div>
<!-- end-chunk -->
<!-- begin-chunk -->
<h4 id="identify-mappings">Supported mappings</h4><p>RudderStack maps the following event properties to the corresponding Optimizely properties:</p>
<table>
  <thead>
      <tr>
          <th>RudderStack property</th>
          <th>Optimizely property</th>
          <th>Note</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><code>userId</code> <br /> <code>anonymousId</code> <br/> Required</td>
          <td><code>visitor_id</code></td>
          <td>Determined based on the <strong>Track known users</strong> <a href="https://www.rudderstack.com/docs/destinations/streaming-destinations/optimizely-feature-experimentation/setup-guide/#destination-settings" >dashboard setting</a>.</td>
      </tr>
      <tr>
          <td><code>session_id</code> <br /> <code>context.sessionId</code></td>
          <td><code>session_id</code></td>
          <td>-</td>
      </tr>
  </tbody>
</table>
<p>You can also map the RudderStack user traits to specific Optimizely attributes. See <a href="https://www.rudderstack.com/docs/destinations/streaming-destinations/optimizely-feature-experimentation/setup-guide/#attribute-mappings" >Attribute mappings</a> for more information.</p>
<!-- end-chunk -->
<!-- begin-chunk -->
<h2 id="track">Track</h2><p>You can use the <a href="https://www.rudderstack.com/docs/event-spec/standard-events/track/" ><code>track</code></a> call to send the experiment-related information to Optimizely. RudderStack then sends the event name associated with an active experiment to Optimizely using their <a href="https://docs.developers.optimizely.com/experimentation-data/reference/post_events" >Event API</a>.</p>
<p>To map your <code>track</code> event to specific Optimizely events, use the <strong>RudderStack to Optimizely event mappings</strong> dashboard setting. See <a href="https://www.rudderstack.com/docs/destinations/streaming-destinations/optimizely-feature-experimentation/setup-guide/#track-settings" >Track settings</a> for more information.</p>
<p>A sample <code>track</code> call is shown below:</p>
<div class="rs-code">
  <div class="rs-code__head">javascript<button class="rs-code__copy" type="button">
      
      Copy
    </button>
  </div>
  <div class="highlight"><pre class="chroma"><code class="language-javascript" data-lang="javascript">rudderanalytics.track(
  &#34;Product Added&#34;, {
    item: &#34;Tshirt&#34;,
    currency: &#34;USD&#34;
  })</code></pre></div>
</div>
<!-- end-chunk -->
<!-- begin-chunk -->
<h3 id="track-mappings">Supported mappings</h3><p>RudderStack maps the following event properties to the corresponding Optimizely properties:</p>
<table>
  <thead>
      <tr>
          <th>RudderStack property</th>
          <th>Optimizely property</th>
          <th>Note</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><code>userId</code> <br /> <code>anonymousId</code> <br/> Required</td>
          <td><code>visitor_id</code></td>
          <td>Determined based on the <strong>Track known users</strong> <a href="https://www.rudderstack.com/docs/destinations/streaming-destinations/optimizely-feature-experimentation/setup-guide/#destination-settings" >dashboard setting</a>.</td>
      </tr>
      <tr>
          <td><code>session_id</code> <br /> <code>context.sessionId</code></td>
          <td><code>session_id</code></td>
          <td>-</td>
      </tr>
      <tr>
          <td><code>properties.quantity</code></td>
          <td><code>quantity</code></td>
          <td>-</td>
      </tr>
      <tr>
          <td><code>properties.revenue</code></td>
          <td><code>revenue</code></td>
          <td>RudderStack converts the value of <code>revenue</code> to cents before passing it to Optimizely. For example, $5 will be converted to 500 cents.</td>
      </tr>
      <tr>
          <td><code>properties</code></td>
          <td><code>tags</code></td>
          <td>Other properties except <code>quantity</code> and <code>revenue</code>.</td>
      </tr>
  </tbody>
</table>
<!-- end-chunk -->
<!-- begin-chunk -->
<h2 id="page">Page</h2><p>You can use the <a href="https://www.rudderstack.com/docs/event-spec/standard-events/page/" ><code>page</code></a> call to record your website&rsquo;s page views with any additional relevant information about the viewed page.</p>
<p>RudderStack sends a <code>page</code> call to Optimizely using their <a href="https://docs.developers.optimizely.com/experimentation-data/reference/post_events" >Event API</a> with a valid event name associated with an active experiment.</p>
<p>A sample <code>page</code> call is shown:</p>
<div class="rs-code">
  <div class="rs-code__head">javascript<button class="rs-code__copy" type="button">
      
      Copy
    </button>
  </div>
  <div class="highlight"><pre class="chroma"><code class="language-javascript" data-lang="javascript">rudderanalytics.page(&#34;Home&#34;);</code></pre></div>
</div>
<!-- end-chunk -->
<!-- begin-chunk -->
<h4 id="send-page-name-and-category">Send page name and category</h4><p>To send the page category/name details to Optimizely:</p>
<ol>
<li>Enable <strong>Track Categorized Pages</strong>, <strong>Track Named Pages</strong>, or both, in your <a href="https://www.rudderstack.com/docs/destinations/streaming-destinations/optimizely-feature-experimentation/setup-guide/#page-settings" >dashboard settings</a>.</li>
<li>Map your <code>page</code> event to a specific Optimizely event using the <strong>RudderStack Page Name/Category to Optimizely event mappings</strong> setting.</li>
</ol>
<p>See <a href="https://www.rudderstack.com/docs/destinations/streaming-destinations/optimizely-feature-experimentation/setup-guide/#page-settings" >Page settings</a> for more information.</p>
<!-- end-chunk -->
<!-- begin-chunk -->
<h4 id="supported-mappings">Supported mappings</h4><table>
  <thead>
      <tr>
          <th>RudderStack property</th>
          <th>Optimizely property</th>
          <th>Note</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><code>userId</code> <br /> <code>anonymousId</code> <br/> Required</td>
          <td><code>visitor_id</code></td>
          <td>Determined based on the <strong>Track known users</strong> <a href="https://www.rudderstack.com/docs/destinations/streaming-destinations/optimizely-feature-experimentation/setup-guide/#destination-settings" >dashboard setting</a>.</td>
      </tr>
      <tr>
          <td><code>session_id</code> <br /> <code>context.sessionId</code></td>
          <td><code>session_id</code></td>
          <td>-</td>
      </tr>
      <tr>
          <td><code>properties</code></td>
          <td><code>tags</code></td>
          <td>-</td>
      </tr>
  </tbody>
</table>
<!-- end-chunk -->
<!-- begin-chunk -->
<h2 id="screen">Screen</h2><p>You can use the <a href="https://www.rudderstack.com/docs/event-spec/standard-events/screen/" ><code>screen</code></a> call to record your users&rsquo; mobile screen views with any additional relevant information about the screen.</p>
<p>RudderStack sends a <code>screen</code> call to Optimizely using their <a href="https://docs.developers.optimizely.com/experimentation-data/reference/post_events" >Event API</a> with a valid event name associated with an active experiment.</p>
<p>A sample <code>screen</code> call is shown:</p>
<div class="rs-code">
  <div class="rs-code__head">javascript<button class="rs-code__copy" type="button">
      
      Copy
    </button>
  </div>
  <div class="highlight"><pre class="chroma"><code class="language-javascript" data-lang="javascript">rudderanalytics.screen(&#34;Main&#34;);</code></pre></div>
</div>
<!-- end-chunk -->
<!-- begin-chunk -->
<h4 id="send-screen-name-and-category">Send screen name and category</h4><p>To send the screen category/name details to Optimizely:</p>
<ol>
<li>Enable <strong>Track Categorized Pages</strong>, <strong>Track Named Pages</strong>, or both, in your <a href="https://www.rudderstack.com/docs/destinations/streaming-destinations/optimizely-feature-experimentation/setup-guide/#page-settings" >dashboard settings</a>.</li>
<li>Map your <code>screen</code> event to a specific Optimizely event using the <strong>RudderStack Page Name/Category to Optimizely event mappings</strong> setting.</li>
</ol>
<p>See <a href="https://www.rudderstack.com/docs/destinations/streaming-destinations/optimizely-feature-experimentation/setup-guide/#page-settings" >Page settings</a> for more information.</p>
<!-- end-chunk -->
<!-- begin-chunk -->
<h4 id="supported-mappings-1">Supported mappings</h4><table>
  <thead>
      <tr>
          <th>RudderStack property</th>
          <th>Optimizely property</th>
          <th>Note</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><code>userId</code> <br /> <code>anonymousId</code> <br/> Required</td>
          <td><code>visitor_id</code></td>
          <td>Determined based on the <strong>Track known users</strong> <a href="https://www.rudderstack.com/docs/destinations/streaming-destinations/optimizely-feature-experimentation/setup-guide/#destination-settings" >dashboard setting</a>.</td>
      </tr>
      <tr>
          <td><code>session_id</code> <br /> <code>context.sessionId</code></td>
          <td><code>session_id</code></td>
          <td>-</td>
      </tr>
      <tr>
          <td><code>properties</code></td>
          <td><code>tags</code></td>
          <td>-</td>
      </tr>
  </tbody>
</table>
<!-- end-chunk -->
<!-- begin-chunk -->
<h2 id="view-experimentation-results">View experimentation results</h2><p>To view the experimentation-related metrics, go to the <a href="https://support.optimizely.com/hc/en-us/articles/4410284017421-The-Experiment-Results-page" >Results page</a> page of your Optimizely dashboard. You can also view the results as a <a href="https://docs.developers.optimizely.com/web-experimentation/docs/data-export" >data export</a>.</p>

