The widget will appear below. It's loaded via the production loader script which automatically points to the latest versioned widget file.
Use this code snippet to embed the widget in your website:
<!-- Widget containers --> <div id="tn-app"></div> <!-- Widget loader script with customization options --> <script id="tn-script" src="https://tn.platfone.com/tn.js" data-name="Your Brand" data-logo="https://example.com/logo.png" data-background-color="#ffffff" data-text-color="#333333" data-button-color="#007bff"> </script>
That's it! Just add these lines to your HTML and the widget will be ready to use.
You can customize the widget appearance by modifying the data attributes:
data-name - Your brand name displayed in the widgetdata-logo - URL to your logo imagedata-background-color - Widget background color (hex format)data-text-color - Text color (hex format)data-button-color - Button color (hex format)https://tn.platfone.com/tn.jsThe widget dispatches CustomEvents to notify your application about user interactions and state changes. You can listen to these events to integrate the widget with your application logic.
The widget emits the following events:
tn:widgetLoaded - Widget has finished loadingtn:serviceSelected - User selected a service
service
tn:countrySelected - User selected a country
country
tn:startOrder - User initiated an order
service, country
tn:orderFailed - Order failed
service, country, reason
tn:numberReceived - Number was successfully received
service, country
tn:numberCancelled - Number was cancelled
service, country
tn:reportSent - Report was senttn:addFundsStarted - User started adding fundstn:balanceAdded - Balance was addedRecommended approach: Listen on the widget host element
<script> const host = document.getElementById('tn-app') host.addEventListener('tn:widgetLoaded', () => { console.log('Widget loaded') }) </script>
Alternative approach: Listen on the global window (with guard)
<script> window.addEventListener('tn:widgetLoaded', (e) => { if (e.target !== window) return console.log('Widget loaded (global)') }) </script>
Use this event to know when the widget is ready for user interaction.
<script> const host = document.getElementById('tn-app') host.addEventListener('tn:widgetLoaded', () => { console.log('✅ Widget is ready!') // Initialize your custom logic here }) </script>
This event includes details data with information about the service and country.
<script> const host = document.getElementById('tn-app') host.addEventListener('tn:numberReceived', (event) => { // Type: CustomEvent<{ service: string, country: string }> const { service, country } = event.detail console.log(`📱 Number received for service: ${service}, country: ${country}`) // Track in your analytics // gtag('event', 'number_received', { service, country }) }) </script>
#tn-app) is the most reliable approach.