coreyhaines31/marketingskills / skills/conversion-tracking
conversion-tracking
VerifiedWhen the user wants to set up, audit, or fix conversion tracking to Google Ads, Meta, GA4, LinkedIn, and TikTok, or asks why conversions are missing or doubled: GTM, pixels, CAPI, Enhanced Conversions, offline imports. Fire on confirmed success, not the submit click; verify a test conversion arrives; diagnose before changing; offer free paths and disclose partner tools. For tracking plans, see analytics. For attribution, see attribution. For bidding, see ads.
assets/snippets/forminator.js
View on GitHub/*! Forminator conversion detection (MIT)
* Detects: form submission. Pushes dataLayer event: forminator_form_submitted
* From the conversion-tracking skill in Marketing Skills */
(function () {
if (window.__ctForminatorForms) return;
window.__ctForminatorForms = true;
window.dataLayer = window.dataLayer || [];
var listeners=[],lastEvent=null;
window.__ctForminatorSubscribe=function(listener){if(listener&&typeof listener==='object')listeners.push(listener);};
function isForm(form){
try{return !!(form&&String(form.tagName||'').toLowerCase()==='form'&&form.classList&&form.classList.contains('forminator-custom-form'));}
catch(e){return false;}
}
function notify(phase,form,candidate,event){
var handled=false;
for(var i=0;i<listeners.length;i++)try{var fn=listeners[i]&&listeners[i][phase];if(typeof fn==='function'&&fn(form,candidate,event)===true)handled=true;}catch(e){}
return handled;
}
function submit(event){try{var form=event.target;if(isForm(form))notify('beforeAttempt',form,false,event);}catch(e){}}
function success(event){
try{
if(event&&typeof event==='object'&&event===lastEvent)return;
lastEvent=event;
if(event&&typeof event==='object')setTimeout(function(){if(lastEvent===event)lastEvent=null;},0);
var form=event&&event.target;if(!isForm(form))return;
if(!notify('onCandidate',form,true,event))window.dataLayer.push({event:'forminator_form_submitted',form_id:form.getAttribute('data-form-id')||''});
}catch(e){}
}
document.addEventListener('submit',submit,true);
// Page-reload forms render their verdict in the returned page instead of
// emitting the AJAX event. Read only the confirmation class and form ID.
var confirmedForms=[];
function nativeConfirmations(){
try{
var forms=document.querySelectorAll('form.forminator-custom-form:not(.forminator_ajax)');
for(var i=0;i<forms.length;i++){
var form=forms[i],message=form.querySelector('.forminator-response-message.forminator-success');
if(!message||!message.getClientRects().length||confirmedForms.indexOf(form)!==-1)continue;
confirmedForms.push(form);
success({target:form});
}
}catch(e){}
}
function watchNative(){
nativeConfirmations();
if(window.MutationObserver&&document.documentElement){
new MutationObserver(nativeConfirmations).observe(document.documentElement,{childList:true,subtree:true,attributes:true,attributeFilter:['class','style']});
}
}
if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',watchNative);
else watchNative();
window.addEventListener('load',nativeConfirmations);
function hook(){
try{
if(window.__ctForminatorSuccessHooked)return true;
var jq=window.jQuery||(typeof jQuery!=='undefined'?jQuery:(typeof $!=='undefined'?$:null));
if(!jq)return false;
window.__ctForminatorSuccessHooked=true;
jq(document).on('forminator:form:submit:success',success);return true;
}catch(e){return false;}
}
if(!hook()){document.addEventListener('DOMContentLoaded',hook);window.addEventListener('load',hook);}
})();
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |