{"id":4400,"date":"2024-05-30T09:48:52","date_gmt":"2024-05-30T07:48:52","guid":{"rendered":"https:\/\/www.knowboard.de\/?p=4400"},"modified":"2024-05-30T10:24:20","modified_gmt":"2024-05-30T08:24:20","slug":"add-ga-forminator-event-tracking","status":"publish","type":"post","link":"https:\/\/www.knowboard.de\/add-ga-forminator-event-tracking\/","title":{"rendered":"Add GA Forminator Event Tracking"},"content":{"rendered":"\n
\/* FORMINATOR TRACKING\n * https:\/\/gist.github.com\/wpmudev-sls\/5fc34beaee5a34947cda67ccc6a56bff\n * https:\/\/gist.github.com\/patrickfreitasdev\/46c9dbf946b3cc34a46ae3a24d58635b THIS ONE HERE GA ONLY *\/\n\n\nadd_action( 'wp_footer', function(){\n\n\t\/**\n * Tracking ID and property number\n *\n * The tracking ID is a string like UA-000000-2.\n * It must be included in your tracking code to tell Analytics which account and property to send data to.\n * Help: https:\/\/support.google.com\/analytics\/answer\/7372977\n *\/\n\t$tracking_id = 'AW-941906725';\n\n\t\/**\n * Default: true\n * Set to 'false' if another plugin loads Google Analytics & Facebook Pixel tracking code property.\n *\/\n\t$tracking_code = true;\n\n?>\n\n<?php if( $tracking_code ) { ?>\n\n<!-- Global site tag (gtag.js) - Google Analytics -->\n<script async src=\"https:\/\/www.googletagmanager.com\/gtag\/js?id=<?php echo $tracking_id; ?>\"><\/script>\n<script>\n\twindow.dataLayer = window.dataLayer || [];\n\tfunction gtag(){ dataLayer.push( arguments ); }\n\tgtag( 'js', new Date() );\n\tgtag( 'config', '<?php echo $tracking_id; ?>' );\n\n\tconsole.log( 'Tracking Code placed' );\n<\/script>\n\n<?php } ?>\n\n<?php\n\t\/**\n * Forminator GA Integration\n *\/ ?>\n<script type=\"text\/javascript\">\n\t(function($){\n\t\t$(document).on( 'forminator:form:submit:success', function( formData ){\n\n\t\t\tvar form_id = $(formData.target).find('input[name=\"form_id\"]').val();\n\n\t\t\tif( form_id == 71 ){\n\t\t\t\t\/\/ Do something here...\n\t\t\t}\n\n\t\t\tif ( typeof window['gtag'] == 'function' ) {\n\t\t\t\t<?php\n\t\t\t \/**\n * Measure Google Analytics Events\n * https:\/\/developers.google.com\/analytics\/devguides\/collection\/gtagjs\n *\/ ?>\n\t\t\t\t\/\/gtag( 'event', 'action', { 'event_category': 'category', 'event_label': 'label','value': 'value' } );\n\t\t\t\tgtag( 'event', 'conversion', {'send_to': 'AW-941906725\/gbQICLzsiJIYEKW2kcED'});\n\t\t\t\tconsole.log( 'Tracking Tag fired' );\n\t\t\t} else {\n\t\t\t\tconsole.log( 'Google Analytics not detected. Aborted sending event...' );\n\t\t\t}\n\t\t});\n\t})(jQuery);\n<\/script>\n\n<?php }, 99 );\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"\/* FORMINATOR TRACKING * https:\/\/gist.github.com\/wpmudev-sls\/5fc34beaee5a34947cda67ccc6a56bff * https:\/\/gist.github.com\/patrickfreitasdev\/46c9dbf946b3cc34a46ae3a24d58635b THIS ONE HERE GA ONLY *\/ add_action( 'wp_footer', function(){ \/** * Tracking ID and property number * * The tracking ID is a string like UA-000000-2. * It must be included in your tracking code to tell Analytics which account and property to send data to. * Help:…","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_seopress_robots_primary_cat":"none","_seopress_titles_title":"","_seopress_titles_desc":"","_seopress_robots_index":"","footnotes":""},"categories":[1],"tags":[],"class_list":["post-4400","post","type-post","status-publish","format-standard","hentry","category-allgemein","entry","no-media"],"_links":{"self":[{"href":"https:\/\/www.knowboard.de\/wp-json\/wp\/v2\/posts\/4400","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.knowboard.de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.knowboard.de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.knowboard.de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.knowboard.de\/wp-json\/wp\/v2\/comments?post=4400"}],"version-history":[{"count":1,"href":"https:\/\/www.knowboard.de\/wp-json\/wp\/v2\/posts\/4400\/revisions"}],"predecessor-version":[{"id":4403,"href":"https:\/\/www.knowboard.de\/wp-json\/wp\/v2\/posts\/4400\/revisions\/4403"}],"wp:attachment":[{"href":"https:\/\/www.knowboard.de\/wp-json\/wp\/v2\/media?parent=4400"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.knowboard.de\/wp-json\/wp\/v2\/categories?post=4400"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.knowboard.de\/wp-json\/wp\/v2\/tags?post=4400"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}