Deprecated in MI gtag versions. For gtag, see https://gist.github.com/chavesm/8b719fc32505b26d4dcfa32a0a423617
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Add missing form IDs for conversion tracking. | |
*/ | |
(function(){ | |
// Grab all the forms on the page. | |
const formElts = document.querySelectorAll("form"); | |
// If no forms, bail. | |
if (!formElts.length) return; | |
The approach described below gives you the benefit of managing all of your affiliate links in one place in your WordPress site. Your links will also be more human readable which makes them more brandable, easier to share, and less intimidating.
Say goodbye to time wasted finguring out what all your affiliate links are and how they are performing!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** MonsterInsights Email Hooks */ | |
// Sender email address filter hook. | |
function my_custom_sender_email_address( $original_sender_email_address ) { | |
return 'YOURSENDEREMAILADDRESS'; | |
} | |
add_filter( 'monsterinsights_email_from_address', 'my_custom_sender_email_address' ); | |
// Sender name filter hook. |
Debugging a plugin or theme conflict should be done on a staging site if possible.
While you're debugging (depending on the type of error), you should have the JavaScript console or PHP error log in view in real-time.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // Ignore this line when copying/pasting this code to your child theme's functions.php file. | |
/** | |
* This example sets custom dimension #9 to be the WordPress | |
* post ID of the page/post being visited. | |
* | |
* This is compatible with MonsterInsights gtag code. This filter supercedes | |
* the monsterinsights_frontend_tracking_options_analytics_before_pageview | |
* filter. | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** Try to Remove Unnecessary "text/javascript" and "text/css" */ | |
function codeless_remove_type_attr($tag, $handle) { | |
return preg_replace( "/type=['\"]text\/(javascript|css)['\"]/", '', $tag ); | |
} | |
add_filter('style_loader_tag', 'codeless_remove_type_attr', 10, 2); | |
add_filter('script_loader_tag', 'codeless_remove_type_attr', 10, 2); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // Ignore this line if copying to child theme's functions.php | |
/** Remove the unnecessary "type" attribute from MI script code by leaving it out of the filter. */ | |
function remove_type_attr_1148073() { | |
return array( | |
'data-cfasync' => 'false' // Ask CloudFlare Rocket Loader not to execute. | |
); | |
} | |
add_filter( 'monsterinsights_tracking_analytics_script_attributes', 'remove_type_attr_1148073' ); |