Most career flight schools can only offer you their package programs; some might fit you – many will not, but your choice is usually “take it or leave it.” Instead of offering you prepackaged programs that may or may not meet your needs, American Flyers is unique in our industry by giving our students virtually unlimited choices in creating flight training programs tailored to their individual circumstances and needs. Whether you wish to enhance your flying skills, acquire your commercial pilot certificate or become a flight instructor, we can create a program just for you.
/* americanflyers.com - GA4 generate_lead on Net Results thank-you pages.
Browser-driven so it survives the page cache (template_redirect cannot). */
(function () {
var MAP = {
'/thank-you-private-pilot-certificate': '426102d0-4f19-4065-80d6-ae2f61f241c1',
'/thank-you-flight-instructor': '773549b2-1855-499e-bc70-66c90c992014',
'/thank-you-confirmation': '2c1469c3-d149-4252-8779-a8c2ef29e823'
};
var REST = '/wp-json/af-ga4/v1/lead';
var WIN = 10 * 60 * 1000;
var path = window.location.pathname.replace(/\/+$/, '') || '/';
var formId = MAP[path];
if (!formId) return;
function getCookie(n) {
var m = document.cookie.match(new RegExp('(?:^|; )' + n.replace(/([.*+?^${}()|[\]\\])/g, '\\$1') + '=([^;]*)'));
return m ? decodeURIComponent(m[1]) : '';
}
var KEY = 'af_ga4_nr_' + path;
try {
var raw = sessionStorage.getItem(KEY);
if (raw) {
var d = JSON.parse(raw);
if (d && (Date.now() - d.t) < WIN) return;
}
} catch (e) {}
var clientId = getCookie('af_ga_client_id');
if (!clientId) return;
var body = JSON.stringify({
client_id: clientId,
session_id: getCookie('af_ga_session_id'),
form_id: formId,
form_type: 'net_results'
});
function done() {
try { sessionStorage.setItem(KEY, JSON.stringify({ c: clientId, t: Date.now() })); } catch (e) {}
}
try {
if (window.fetch) {
fetch(REST, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: body,
keepalive: true,
credentials: 'same-origin'
}).then(done).catch(function () {});
return;
}
var x = new XMLHttpRequest();
x.open('POST', REST, true);
x.setRequestHeader('Content-Type', 'application/json');
x.onload = done;
x.send(body);
} catch (e) {}
})();