Why would you want to use the JS bridge?
To remotely change the stats sent to FollowAnalytics! If your app includes a JS bridge no need to perform an app update. Your website changes will automatically reflect in your FollowAnalytics stats.
It is useful to enrich your FollowAnalytics dashboards.
It provides you tremendous flexibility regarding campaign scenarios. Just add new tags on the website and create your FollowAnalytics campaigns, that's it! You won't even need to contact your CSM.
How does it work?
Just use our JS methods in the web application. No need to add the FollowAnalytics object in your app, the wrapper will handle it directly.
How can you use the bridge?
Once our developers inject the JS Bridge into the application you can call any public function of the FollowAnalytics Analyse & Engage SDK.
✅ Calling from a link
...
<a href="link here" onclick="FollowAnalytics.logEvent('add to cart')">Add to Cart</a>
...
✅ Calling from a function attached to a DOM element
<button id="MY_BUTTON">Test log</button>
var el = document.getElementById("MY_BUTTON");
el.addEventListener("click", function() {
// you code here
FollowAnalytics.logEvent("magic button clicked");
...
}
✅. Logging a page load
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>The HTML5 Herald</title>
<meta name="description" content="The HTML5 Herald">
<meta name="author" content="SitePoint">
<link rel="stylesheet" href="css/styles.css?v=1.0">
<script>
document.addEventListener("DOMContentLoaded", function(evt) {
// page has loaded, let's log the page title
FollowAnalytics.logEvent("page loaded", document.title);
});
</script>
</head><body>
<script src="js/scripts.js"></script>
</body>
</html>
Public functions available
Any of the methods below can be called from the web application,
- Followanalytics.getUserId
- Followanalytics.getDeviceId
- Followanalytics.getOptInNotifications
- Followanalytics.getSDKVersion
- Followanalytics.getSDKPlatform
- Followanalytics.setOptInNotifications
- Followanalytics.openNotificationSettingsEventually
- Followanalytics.logEvent
- Followanalytics.logError
- Followanalytics.logLocation
|--> Android : requires AndroidManifest permission `<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />`
- Followanalytics.setUserId
- Followanalytics.setFirstName
- Followanalytics.setLastName
- Followanalytics.setEmail
- Followanalytics.setDateOfBirth
- Followanalytics.setGender
- Followanalytics.setCountry
- Followanalytics.setCity
- Followanalytics.setRegion
- Followanalytics.setProfilePictureUrl
- Followanalytics.setNumber
- Followanalytics.setString
- Followanalytics.setBoolean
- Followanalytics.setDate
- Followanalytics.setDateTime
- Followanalytics.clear
- Followanalytics.addToSet
- Followanalytics.removeFromSet
- Followanalytics.clearSet
- Followanalytics.requestNotificationAuthorization
- Followanalytics.isRegisteredForPushNotifications
- Followanalytics.setOptInAnalytics
For further information about FA Javascript Methods please check our Web SDK documentation .
Data regulation friendly recommendation:
Using our Analyze & Engage SDK, we should tie the cookie consent to the Analytics Tracking, meaning that we should only activate the SDK when the user accepts it. When that happens, you need to call the FollowAnalytics.setOptinAnalytics(true)
.
If you have any questions related to this article please do not hesitate to get in touch with your CSM.