To capture CF7 events in Google Tag Manager, you need a reliable custom listener. Since Contact Form 7 dispatches native DOM events on successful submissions, we can listen for these signals directly and push a custom [cf7submission] event directly into GTM's dataLayer. This strategy extracts crucial telemetry such as the unique [formId] and the user's structured [response] inputs.
Copy the optimized JavaScript code block below and deploy it inside Google Tag Manager as a Custom HTML Tag. For global tracking, configure the tag to trigger on All Pages (or restrict it to pages housing active web forms).
document.addEventListener('wpcf7mailsent', function(event) {
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
'event': 'cf7submission',
'formId': event.detail.contactFormId,
'response': event.detail.inputs
});
}, false);