Complete guide for integrating the Flott booking widget
The Flott booking widget provides a seamless way to integrate ride booking functionality into your website. This widget is built as a Web Component that can be embedded directly into any web page.
The widget provides:
Get started with the Goflott widget in just a few steps:
Method 1 - JavaScript Widget (Recommended):
<script src="https://embed.goflott.com/embed.js"></script>
<goflott-widget partner-id="your-partner-id"></goflott-widget>
Method 2 - Simple iframe embedding:
For basic integration without JavaScript, use an iframe:
<iframe
src="https://embed.goflott.com?partnerId=your-partner-id&primaryColor=%23ea580c"
width="100%"
height="400"
frameborder="0">
</iframe>
That's it! The widget will automatically load and be ready for bookings.
The widget supports extensive configuration through attributes and JSON configuration.
Basic attributes:
Advanced configuration using the config attribute:
<goflott-widget
partner-id="your-partner-id"
config='{"branding":{"title":"Book Your Ride"},"layout":{"background":"card","shadow":"card"}}'>
</goflott-widget>
For React applications, you can use the widget as shown in our BookingWidget component:
import { useEffect } from 'react';
export function BookingWidget() {
useEffect(() => {
// Load widget script
const script = document.createElement('script');
script.src = 'https://embed.goflott.com/embed.js';
script.async = true;
document.head.appendChild(script);
// Set up event listeners
const handleBookingCompleted = (event) => {
console.log('Booking completed:', event.detail);
};
document.addEventListener('booking-completed', handleBookingCompleted);
return () => {
document.removeEventListener('booking-completed', handleBookingCompleted);
};
}, []);
return (
<goflott-widget
partner-id="your-partner-id"
locale="en"
theme="light"
primary-color="#ea580c"
/>
);
}
The widget emits several events that you can listen to for integration:
const widget = document.querySelector('goflott-widget');
widget.addEventListener('booking-completed', (event) => {
const { tripId, orderId } = event.detail;
console.log('Booking completed:', { tripId, orderId });
// Redirect to success page or update UI
});
widget.addEventListener('booking-error', (event) => {
const { code, message } = event.detail;
console.error('Booking error:', { code, message });
// Show error message to user
});
The widget provides multiple styling options:
Transparent (Default): Perfect for seamless integration
Card Style: Professional appearance with background and shadow
Custom Branding: Match your brand colors and theme
You can customize the widget appearance using:
<goflott-widget
partner-id="your-partner-id"
config='{"branding":{"primaryColor":"#ea580c","title":"Book Your Ride"},"layout":{"background":"card","shadow":"subtle"}}'>
</goflott-widget>
For simple integration without JavaScript, you can use iframe embedding:
Basic iframe setup:
<iframe
src="https://embed.goflott.com?partnerId=your-partner-id"
width="100%"
height="400"
frameborder="0">
</iframe>
Supported URL parameters:
Example with custom styling:
<iframe
src="https://embed.goflott.com?partnerId=your-partner-id&primaryColor=%23ea580c&locale=en&theme=light"
width="100%"
height="450"
frameborder="0"
style="border-radius: 8px; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);">
</iframe>
Note: iframe embedding provides basic functionality but has limitations compared to the JavaScript widget (no event handling, limited customization).
The widget supports multiple languages:
Set the locale using the locale attribute:
<goflott-widget partner-id="your-partner-id" locale="de"></goflott-widget>
You can also provide multilingual titles:
<goflott-widget
partner-id="your-partner-id"
title-en="Book Your Ride"
title-de="Ihre Fahrt buchen"
title-it="Prenota la tua corsa">
</goflott-widget>
Common issues and solutions:
Widget not appearing:
Styling issues:
Events not firing:
For additional support, contact [email protected] with:
<!-- Load the widget script -->
<script src="https://embed.goflott.com/embed.js"></script>
<!-- Add the widget to your page -->
<goflott-widget partner-id="your-partner-id"></goflott-widget>
<!-- Simple iframe embedding -->
<iframe
src="https://embed.goflott.com?partnerId=your-partner-id&primaryColor=%23ea580c"
width="100%"
height="400"
frameborder="0"
style="border-radius: 8px;">
</iframe>
<!-- iframe with all parameters -->
<iframe
src="https://embed.goflott.com?partnerId=your-partner-id&primaryColor=%23ea580c&locale=en&theme=light"
width="100%"
height="450"
frameborder="0"
style="border-radius: 8px; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);">
</iframe>
<goflott-widget
partner-id="your-partner-id"
locale="en"
theme="light"
primary-color="#ea580c"
title-en="Book Your Ride"
title-de="Deine Fahrt buchen"
title-it="Prenota la tua corsa"
config='{
"branding": {
"showLogo": true,
"logoUrl": "https://your-domain.com/logo.png"
},
"layout": {
"background": "card",
"shadow": "subtle",
"borderRadius": "lg"
},
"places": {
"locationBias": {
"circle": {
"center": {"latitude": 46.498295, "longitude": 11.354758},
"radius": 50000
}
}
}
}'>
</goflott-widget>
import { useEffect, useRef } from 'react';
export function BookingWidget() {
const widgetRef = useRef(null);
useEffect(() => {
// Load widget script
const script = document.createElement('script');
script.src = 'https://embed.goflott.com/embed.js';
script.async = true;
document.head.appendChild(script);
// Set up event listeners
const handleBookingCompleted = (event) => {
const { tripId, orderId } = event.detail;
console.log('Booking completed:', { tripId, orderId });
// Handle successful booking
};
const handleBookingError = (event) => {
const { code, message } = event.detail;
console.error('Booking error:', { code, message });
// Handle booking error
};
document.addEventListener('booking-completed', handleBookingCompleted);
document.addEventListener('booking-error', handleBookingError);
return () => {
document.removeEventListener('booking-completed', handleBookingCompleted);
document.removeEventListener('booking-error', handleBookingError);
};
}, []);
return (
<goflott-widget
ref={widgetRef}
partner-id="your-partner-id"
locale="en"
theme="light"
primary-color="#ea580c"
/>
);
}
Complete API reference for advanced integrations
Need help? Contact [email protected]