I am trying to use FXM to track user activity and trigger events etc on a mobile app using Xamarin.

Everything is setup in the federated experience manager in Sitecore, although of course it reports that the beacon is not installed because you can't ping a mobile app using a domain name. Because of this limitation you also can't use things like placeholder/content injection but my plan was to handle event and goal registration using the FXM JavaScript API and accept that injecting content from Sitecore will not work.

I have set FXM to the DEBUG log level and using a basic html site I can see the logs being populated with page tracking information so I have validated that FXM works in that scenario. I have also overridden the FXM tracking pipelines and beacon controller to be able to set break points and monitor the "flow" of an FXM request.

What I cannot yet do is see any of these pipelines, controller, logging etc being hit when loading the beacon on the mobile app. I am loading the beacon by adding a WebView to my layout on the android app:

var view = FindViewById<WebView>(Resource.Id.webView1);

view.Settings.JavaScriptEnabled = true;
view.SetWebChromeClient(new WebChromeClient());
view.AddJavascriptInterface(new Foo(this), "Foo");

And then in the html itself I have:

    <p>Host: <span id="fxmHost"></span></p>
    <script src="http://code.jquery.com/jquery-2.1.4.min.js"></script>

    <script type="text/javascript" src="http://www.local-sitecore-host.com/bundle/beacon"></script>

    <script type="text/javascript">


        SCBeacon.trackEvent('Page visited', { data: 'Launch', dataKey: 'Activity', xKey1: 'test' });



What's interesting is that the span with the id fxmHost is displaying the expected output of SCBeacon.fxmHost so I know that the FXM script is being loaded however no call to trackPageVisit?contactId=... or trackEvent is being registered in Sitecore, no requests from the app show up in fiddler either.

So my question(s) are:

  1. Does FXM need to be loaded differently within a mobile app to work?
  2. Has anyone managed to get FXM working on a native or otherwise mobile app
  3. Are there any special configurations withing Sitecore to support this?

Any help much appreciated. Unfortunately upgrading to version 9 and using xConnect is not an option at this time.

1 Answer 1


It turns out that the FXM script creates an instance of SCBeacon using a Sitecore domain without a specified protocol i.e. //host. Within the app this was being interpreted as a file request and therefor not handled correctly. I added a custom WebViewClient to my WebView which overrides the ShouldInterceptRequest method, which allows me to intercept POST requests to the FXM services and handle them myself in terms of:

  1. Adding an explicit protocol
  2. Adding a custom sessionId (as this was also blank)
  3. Setting cookies returned in the response (SC_ANALYTICS_GLOBAL_COOKIE & site language)
  4. Mapping app activities to a page structure for the "page" parameter
  5. Passing the contactId (retrieved from the previously set cookie)

Things seem to be working now in that I can see requests hitting Sitecore from the App and data going into xDb but I won't mark this as answered in case anyone out there says "no don't do that, there's a much easier way"


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.