DepartCart's GTM integration provides the fastest way to add seat selection and ancillary services to your website. Simply add our GTM code to your confirmation pages, and seat selection panels will automatically appear for eligible bookings.
Copy this code into a new GTM tag:
<script>
(function() {
// Ultra-minimal GTM injectable - just loads the script, no logic
var script = document.createElement('script');
script.src = 'https://departcart.com/static/loaders-dist/seat_selection_loader.js';
script.setAttribute('data-gtm-source', 'true');
document.head.appendChild(script);
})();
</script>
Replace YOUR_BRAND_NAME in the code above with your actual brand name (provided during onboarding).
Create a GTM trigger that fires on pages containing booking confirmations:
Trigger Type: Page View
Trigger Conditions:
- Page URL contains: confirmation OR booking OR pnr
- Page Path matches: /booking-confirmation OR /manage-booking OR similar
If your booking confirmation pages use different CSS classes, update the targetSelectors array:
targetSelectors: [
'.your-custom-booking-class',
'#booking-confirmation-section',
'[data-booking-type="confirmation"]'
]
Enable debug mode to see console logs during development:
debugMode: true // Shows detailed console logs
Add custom CSS to match your brand:
<style>
.aa-seat-selection-panel {
margin: 25px 0;
padding: 20px;
border: 1px solid #e0e0e0;
border-radius: 8px;
background: #f9f9f9;
}
.aa-seat-selection-panel h3 {
color: #your-brand-color;
font-family: your-brand-font;
}
</style>
Our script automatically searches for PNR data using these methods:
data-pnr, data-booking-reference, etc.?pnr= or ?confirmation= parametersPassenger names are extracted from:
lastName, surname, passenger_namePNR Formats:
ABC123 (6 characters)A1B2C3 (alphanumeric)ABCDEF (all letters)123456 (all numbers)Name Formats:
SMITH (last name only)John SMITH (first + last)SMITH, John (last, first)SMITH/JOHN (last/first)targetSelectorsdebugMode: true and check browser console<div class="booking-summary" data-pnr="ABC123" data-last-name="SMITH">
.aa-seat-selection-panel { z-index: 1000; position: relative; }
For optimal detection, structure your confirmation pages like this:
<div class="booking-confirmation">
<h2>Booking Confirmed</h2>
<div class="flight-details" data-pnr="ABC123">
<h3>Flight Information</h3>
<p><strong>Confirmation Code:</strong> ABC123</p>
<p><strong>Passenger:</strong> John SMITH</p>
<p><strong>Flight:</strong> AA1234 JFK → LAX</p>
<p><strong>Date:</strong> June 20, 2025</p>
</div>
<!-- DepartCart seat selection panel will appear here -->
<div class="booking-actions">
<button>View Itinerary</button>
<button>Manage Booking</button>
</div>
</div>
Monitor GTM integration performance:
// Add to your analytics
gtag('event', 'departcart_panel_shown', {
'event_category': 'ancillaries',
'event_label': 'seat_selection'
});
Automatic error reporting helps us improve the integration:
window.addEventListener('error', function(e) {
if (e.filename && e.filename.includes('departcart')) {
// Error in DepartCart code - automatically reported
}
});
For technical support during implementation, email gtm-support@departcart.com