Home Features How It Works Pricing Integrations FAQ Contact
← Back to Integrations Integrations · PHP

A copy-paste iframe, with real tracking.

No plugin needed — just an iframe embed and one small helper function, so Google Ads and Meta can still attribute bookings correctly.

// 01

Helper function

Add this once, in a shared include:

includes/fb-tracking.php
<?php
function fb_tracking_query() {
    $keys = ['gclid','gbraid','wbraid','utm_source','utm_medium','utm_campaign','utm_term','utm_content','fbclid'];
    $qs = '';
    foreach ($keys as $k) {
        $val = '';
        if (!empty($_GET[$k])) {
            $val = $_GET[$k];                       // 1st: this page's own URL
        } elseif (!empty($_COOKIE['fb_' . $k])) {
            $val = $_COOKIE['fb_' . $k];             // 2nd: sitewide cookie (see below)
        }
        if ($val !== '') {
            $qs .= '&' . $k . '=' . rawurlencode($val);
        }
    }
    return $qs;
}
?>
// 02

Compact widget

<iframe
  src="https://app.farebookings.com/booking-widget.php?k=YOUR_COMPANY_KEY&lng=gb<?php echo fb_tracking_query(); ?>"
  width="100%" height="640" frameborder="0" scrolling="no" style="border:none">
</iframe>
// 03

Full booking form

<iframe
  src="https://app.farebookings.com/step1sslv3.php?k=YOUR_COMPANY_KEY&d=pp&lng=gb<?php echo fb_tracking_query(); ?>"
  width="100%" scrolling="no" style="border:none;min-height:1400px">
</iframe>

Replace YOUR_COMPANY_KEY with the real key from the Frontend tab of your panel.

// 04 · Recommended if running paid campaigns

Sitewide tracking

Add this to the shared footer/template of every page:

<script>
(function(){
  var keys = ['gclid','gbraid','wbraid','utm_source','utm_medium','utm_campaign','utm_term','utm_content','fbclid'];
  keys.forEach(function(k){
    var m = new RegExp('[?&]'+k+'=([^&#]*)').exec(window.location.href);
    if(m){
      document.cookie = 'fb_' + k + '=' + m[1] + ';max-age=7776000;path=/;SameSite=Lax';
    }
  });
})();
</script>

This stores the campaign data as soon as it's seen on any page, so fb_tracking_query() can still pick it up even if the visitor browsed a few pages before reaching the widget.

// Common options
Dark modeAdd &dark=1 to the iframe URL.
Options panel openAdd &opts_open=1.
LanguageChange lng=gb to lng=es, lng=fr, etc.
// Checking it worked

Verifying tracking works

  1. Visit any page with ?gclid=test123 on the end of the URL.
  2. Open the browser console (F12) → type document.cookie.
  3. fb_gclid=test123 should be there.
  4. Navigate to another page (without the parameter) and confirm the cookie is still there before reaching the widget/form.

Building on a different platform?

There are dedicated guides for WordPress and sites with no backend at all.