# FullStory Device Mode Integration

<p>This guide will help you send events to FullStory in <a href="https://www.rudderstack.com/docs/destinations/rudderstack-connection-modes/#device-mode" >device mode</a> using their native web/mobile SDK.</p>

<blockquote class="warning">
  <div class="tip-quote">
    
    <div class="tip-text">Before sending events, follow the instructions in the <a href="https://www.rudderstack.com/docs/destinations/streaming-destinations/fullstory/setup-guide/" >Setup guide</a> to set up the FullStory device mode integration depending on your platform.</div>
  </div>
</blockquote>
<!-- 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> method to uniquely identify a user in FullStory.</p>
<p>A sample <code>identify</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.identify(&#34;1hKOmRA4GRlm&#34;, {
  displayName: &#34;Alex&#34;,
  email: &#34;alex@example.com&#34;,
  country: &#34;US&#34;,
});</code></pre></div>
</div>
<p>RudderStack translates the above call to FullStory&rsquo;s <code>identify</code> call as follows:</p>
<ul>
<li>Sends <code>userId</code> as <code>uid</code>.</li>
<li>Passes the remaining traits as is.</li>
</ul>

<html lang="en">
<blockquote class="info">
  <div class="tip-quote">
    
    <div class="tip-text">In web device mode, RudderStack sends the <code>anonymousId</code> of the user as <code>uid</code> if you do not provide the <code>userId</code>.</div>
  </div>
</blockquote>

</html>
<p><code>displayName</code> and <code>email</code> are <strong>optional</strong> traits and FullStory handles them differently. Once specified in the <code>identify</code> call, they show up automatically the next time you browse your user list in FullStory.</p>
<p>See <a href="https://help.fullstory.com/hc/en-us/articles/360020828113#displayname" >FullStory documentation</a> for more information.</p>
<!-- end-chunk -->
<!-- begin-chunk -->
<h2 id="track">Track</h2><p>The <a href="https://www.rudderstack.com/docs/event-spec/standard-events/track/" ><code>track</code></a> call lets you track custom events as they occur in your web application.</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;Order Completed&#34;, {
  orderId: &#34;1234567&#34;,
  price: &#34;567&#34;,
  currency: &#34;USD&#34;,
});</code></pre></div>
</div>
<p>RudderStack passes a <code>track</code> call with all its associated event properties to FullStory via its <a href="https://help.fullstory.com/hc/en-us/articles/360020623274-FS-event-API-Sending-custom-event-data-into-FullStory" >FS.event</a> method.</p>
<!-- end-chunk -->
<!-- begin-chunk -->
<h2 id="page">Page</h2><p>The <a href="https://www.rudderstack.com/docs/event-spec/standard-events/page/" ><code>page</code></a> call lets you record your website&rsquo;s page views, with any additional relevant information about the viewed page. By default, RudderStack sends all <code>page</code> calls to FullStory as events.</p>
<p>A sample <code>page</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.page(&#34;homepage&#34;);</code></pre></div>
</div>
<p>The above call sends a <code>Viewed a Page</code> event to FullStory along with the following properties:</p>
<ul>
<li><code>name</code> (<code>homepage</code> in the above example)</li>
<li><code>path</code></li>
<li><code>referrer</code></li>
<li><code>search</code></li>
<li><code>title</code></li>
<li><code>url</code></li>
</ul>
<p>RudderStack also passes any additional properties in the <code>page</code> call to FullStory.</p>
<!-- end-chunk -->
<!-- begin-chunk -->
<h2 id="screen">Screen</h2><p>The <a href="https://www.rudderstack.com/docs/event-spec/standard-events/screen/" ><code>screen</code></a> call is the mobile equivalent of the <a href="https://www.rudderstack.com/docs/event-spec/standard-events/page/" ><code>page</code></a> call. It lets you record the screen views on your mobile app along with other relevant information about the screen.</p>

<html lang="en">
<blockquote class="info">
  <div class="tip-quote">
    
    <div class="tip-text">RudderStack sends the <code>screen</code> call to FullStory as a custom event.</div>
  </div>
</blockquote>

</html>
<p>A sample <code>screen</code> call is shown below:</p>
<div class="rs-code">
  <div class="rs-code__head">kotlin<button class="rs-code__copy" type="button">
      
      Copy
    </button>
  </div>
  <div class="highlight"><pre class="chroma"><code class="language-kotlin" data-lang="kotlin">MainApplication.rudderClient.screen(
    &#34;Sample Screen Name&#34;,
    RudderProperty().putValue(&#34;prop_key&#34;, &#34;prop_value&#34;)
)</code></pre></div>
</div>
<p>In the above snippet, RudderStack captures all the information related to the viewed screen, along with any additional info associated with that event. In FullStory, the above <code>screen</code> call is shown as <code>Screen Viewed</code>, along with the associated properties.</p>
<!-- end-chunk -->
<!-- begin-chunk -->
<h2 id="reset">Reset</h2><p>The <code>reset</code> method resets the previously identified user and any related information. See <a href="https://developer.fullstory.com/anonymize?lang=ObjectiveC" >FullStory Reset API</a> for more information.</p>
<p>A sample <code>reset</code> call for iOS is shown below:</p>
<div class="rs-code">
  <div class="rs-code__head">objectivec<button class="rs-code__copy" type="button">
      
      Copy
    </button>
  </div>
  <div class="highlight"><pre class="chroma"><code class="language-objectivec" data-lang="objectivec">[[RSClient sharedInstance] reset];</code></pre></div>
</div>
<p>A sample <code>reset</code> call for Android is shown below:</p>
<div class="rs-code">
  <div class="rs-code__head">kotlin<button class="rs-code__copy" type="button">
      
      Copy
    </button>
  </div>
  <div class="highlight"><pre class="chroma"><code class="language-kotlin" data-lang="kotlin">MainApplication.rudderClient.reset()</code></pre></div>
</div>
<!-- end-chunk -->
<!-- begin-chunk -->
<h2 id="faq">FAQ</h2><!-- end-chunk -->
<!-- begin-chunk -->
<h4 id="how-do-i-prevent-fullstory-from-automatically-recording-on-startup"><strong>How do I prevent FullStory from automatically recording on startup?</strong></h4><p>By default, FullStory automatically requests a session and starts recording on the app&rsquo;s startup.</p>
<p>To start recording the app only when certain conditions are met, you can use FullStory&rsquo;s <code>RecordOnStart</code> feature. Configuring FullStory to disable <code>RecordOnStart</code> prevents any recording until you explicitly invoke <code>FS.restart</code>.</p>
<p>Follow these steps:</p>
<p><strong>For iOS</strong></p>
<p>In your iOS app’s <code>Info.plist</code> FullStory dictionary, add a <code>RecordOnStart</code> key of type <code>Boolean</code> with a value of <code>NO</code>.</p>
<p>See <a href="https://help.fullstory.com/hc/en-us/articles/360042772333-Getting-Started-with-iOS-Recording#01ER0FEDVJS9RJ843477QPRYS6" >FullStory iOS documentation</a> for more information.</p>
<p><strong>For Android</strong></p>
<p>Go to your FullStory plugin configuration (where you set the organiation ID) and set the following:</p>
<div class="rs-code">
  <div class="rs-code__head">groovy<button class="rs-code__copy" type="button">
      
      Copy
    </button>
  </div>
  <div class="highlight"><pre class="chroma"><code class="language-groovy" data-lang="groovy">fullstory {
org &#39;YOUR_ORG_ID_HERE&#39;
recordOnStart false
}</code></pre></div>
</div>
<p>See <a href="https://help.fullstory.com/hc/en-us/articles/360040596093-Getting-Started-with-Android-Recording#01F5E7XY5HJYV5ZWCCSYNQ8TXC" >FullStory Android documentation</a> for more information.</p>
<!-- end-chunk -->
<!-- begin-chunk -->
<h4 id="how-do-i-subclass-from-an-application-in-android"><strong>How do I subclass from an application in Android?</strong></h4><p>FullStory requires that you enable MultiDex. If your minSdkVersion is set to 21 or higher, Multidex is enabled by default. In this case, you will need to extend <code>android.app.Application</code>, otherwise there will be a build error. If your minSdkVersion is lower than 21, you will need to subclass from <code>androidx.multidex.MultiDexApplication</code> instead.</p>
<p>If you&rsquo;re using Java and if you do not have an application class, you will need to create one. In your <code>App.java</code>, add the following:</p>
<div class="rs-code">
  <div class="rs-code__head">java<button class="rs-code__copy" type="button">
      
      Copy
    </button>
  </div>
  <div class="highlight"><pre class="chroma"><code class="language-java" data-lang="java">import android.app.Application;
public class App extends Application {
...
}</code></pre></div>
</div>
<p>If you&rsquo;re using Kotlin and if you do not have an application class, you will need to create one and add the following in your <code>App.kt</code>:</p>
<div class="rs-code">
  <div class="rs-code__head">kotlin<button class="rs-code__copy" type="button">
      
      Copy
    </button>
  </div>
  <div class="highlight"><pre class="chroma"><code class="language-kotlin" data-lang="kotlin">import android.app.Application

class App: Application() {
...
}</code></pre></div>
</div>
<p>Then, set <code>android:name=&quot;App&quot;</code> in your <code>AndroidManifest.xml</code> under the <code>&lt;application&gt;</code> tag as shown:</p>
<div class="rs-code">
  <div class="rs-code__head">xml<button class="rs-code__copy" type="button">
      
      Copy
    </button>
  </div>
  <div class="highlight"><pre class="chroma"><code class="language-xml" data-lang="xml">&lt;application
android:name=&#34;App&#34; ….</code></pre></div>
</div>
<!-- end-chunk -->
<!-- begin-chunk -->
<h4 id="build-was-configured-to-prefer-settings-repositories-over-project-repositories-but-repository-google-was-added-by-build-file-buildgradle-what-do-i-do"><strong>Build was configured to prefer settings repositories over project repositories but repository &lsquo;Google&rsquo; was added by build file &lsquo;build.gradle&rsquo;. What do I do?</strong></h4><p>Go to your <code>settings.gradle</code> file located in the root, and then comment or remove this line: <code>repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)</code> as shown in the following snippet:</p>
<div class="rs-code">
  <div class="rs-code__head">groovy<button class="rs-code__copy" type="button">
      
      Copy
    </button>
  </div>
  <div class="highlight"><pre class="chroma"><code class="language-groovy" data-lang="groovy">dependencyResolutionManagement {
    // repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        jcenter() // Warning: this repository is going to shut down soon
    }
}
rootProject.name = &#34;FullStory_Sample_App&#34;
include &#39;:app&#39;</code></pre></div>
</div>
<p>For more information, see <a href="https://help.fullstory.com/hc/en-us/articles/360040596093-Getting-Started-with-Android-Recording#01F5E7X1NYJY51ME0PEWSM0KBJ" >FullStory documentation</a>.</p>
<br />
