JSFiddle - React, Tailwind, and code Playground
by Zero Yu
HTML
<html>
<head>
<script>
function confirmOptIn() {
const user_ref = document.querySelector('.fb-messenger-checkbox')
const user_ref_value = user_ref.dataset.user_ref
console.log(user_ref_value)
FB.AppEvents.logEvent('MessengerCheckboxUserConfirmation', null, {
'app_id':'<APP_ID>',
'page_id':'<PAGE_ID>',
'ref':'<PASS_THROUGH_PARAM>',
'user_ref':'<UNIQUE_REF_PARAM>'
});
}
</script>
</head>
<body>
<input type="button" onclick="confirmOptIn()" value="Confirm Opt-in"/>
<div class="fb-messenger-checkbox"
origin=""
page_id=""
messenger_app_id="<APP_ID>"
user_ref=""
allow_login="<true>"
size="<small | medium | large | standard | xlarge>"
skin="<light|dark>"
center_align="<true|false>">
</div>
</body>
</html>
JavaScript
const user_ref = document.querySelector('.fb-messenger-checkbox')
const user_ref_value = Math.random()
user_ref.dataset.user_ref = user_ref_value