googleTag(); add_action("wp_head", function() { $this->metaPixel(); }); // The custom script is given priority over any other scripts. add_action("wp_head", function() { $this->other(); }, 0); } public function googleTag() { $gtag_id = get_option("akari_worker_google_analytics_id"); // If its a Google Analytics tag. if ($gtag_id && preg_match('/G-[a-z0-9]+/i', $gtag_id)) { add_action("wp_head", function() { $this->googleAnalytics(); }); } // If its a Google Tag Manager Tag. if ($gtag_id && preg_match('/GTM-[a-z0-9]+/i', $gtag_id)) { $this->googleTagManager(); } } public function googleAnalytics() { ?>