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");
view.LoadUrl("file:///android_asset/fxm-interface.html");
And then in the html itself I have:
<html>
<body>
<h1>FXM</h1>
<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">
$('#fxmHost').text(SCBeacon.fxmHost);
SCBeacon.trackEvent('Page visited', { data: 'Launch', dataKey: 'Activity', xKey1: 'test' });
</script>
</body>
</html>
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:
- Does FXM need to be loaded differently within a mobile app to work?
- Has anyone managed to get FXM working on a native or otherwise mobile app
- 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.