RefinerSdk.initRefiner(projectId: 'YOUR-PROJECT-ID')
final refinerUser = RefinerUser(userId: userInfo.username, userTraits: userTraitsJson);
RefinerPackage.identifyUser(user: refinerUser);
RefinerSdk.trackEvent(eventName: 'eventName')
RefinerSdk.trackScreen(screenName: 'screenName')
RefinerSdk.resetUser()
Add this script to your index.html inside head tag:
<script type="text/javascript">
function identifyUser(params) {
_refiner('identifyUser', params);
(function () {
var a = document.createElement("script");
a.type = "text/javascript";
a.async = !0;
a.src = "https://js.refiner.io/v001/client.js";
var b = document.getElementsByTagName("script")[0];
b.parentNode.insertBefore(a, b)
})();
}
window._refinerQueue = window._refinerQueue || [];
function _refiner() { _refinerQueue.push(arguments); }
function initRefiner(projectId) {
_refiner('setProject', projectId);
}
function trackEvent(eventName) {
_refiner('trackEvent', eventName);
}
function resetUser() {
_refiner('resetUser');
}
</script>