Skip to content

Instantly share code, notes, and snippets.

View dpaternina9's full-sized avatar

David Paternina dpaternina9

  • Awesome Motive
  • Colombia
  • 22:16 (UTC -05:00)
View GitHub Profile
@dpaternina9
dpaternina9 / exactmetrics_custom_add_sml_dimensions.php
Created August 4, 2023 16:55
exactmetrics_custom_add_sml_dimensions
<?php
function exactmetrics_custom_add_sml_dimensions( $options ) {
if ( ! is_membership_available() ) {
return $options;
}
$dimensions = exactmetrics_get_option( 'custom_dimensions', array() );
<?php
function monsterinsights_custom_redirect_pageview()
{
if (function_exists('monsterinsights_get_uuid') && is_singular()) {
if (!monsterinsights_track_user()) {
return false;
}
@dpaternina9
dpaternina9 / mi-disable-tags-in-rss.php
Created January 30, 2023 20:24
MI Disable tags in RSS
<?php
add_filter('monsterinsights_get_option_tag_links_in_rss', '__return false');
<?php
add_filter('monsterinsights_skip_tracking', '__return_true');
<?php
add_filter( 'monsterinsights_frontend_tracking_options_gtag_before_pageview', function( $options, $type ) {
$user_id = 999; // Replace with code to get actual user ID here
$meta_key = 'my_meta_key'; // Replace with the user meta key here
$meta_value = get_user_meta( $user_id, $meta_key );
if ( $type === 'ua' ) {
// If the customer is tracking for a UA property
<?php
function monsterinsights_skip_woo_manual_orders( $skip, $order_id ) {
$order = wc_get_order( $order_id );
if ( $order && $order->is_created_via('admin') ) {
return true;
}
return $skip;
<?php
function monsterinsights_amz_appl_affiliate_links() {
?>
<script>
jQuery( document ).ready(function() {
jQuery('a[href*="amazon.com"],a[href*="amzn.to"],a[href*="tv.apple"]').each(function() {
jQuery(this).attr('data-vars-ga-category', 'outbound-link-affiliate' );
});
});
</script>
<?php
function monsterinsights_cookieyes_dual_tracking_fix( $attributes ) {
if ( class_exists( 'Cookie_Law_Info_Cookieyes' ) ) {
$attributes['type'] = 'text/plain';
$attributes['data-cli-class'] = 'cli-blocker-script';
$attributes['data-cli-script-type'] = 'analytics';
$attributes['data-cli-block'] = 'true';
$attributes['data-cli-element-position'] = 'head';
}
<?php
add_filter( 'ampforwp_google_analytics_fields', 'monsterinsights_ampforwp_analytics_dimensions_fix', 11 );
function monsterinsights_ampforwp_analytics_dimensions_fix( $ga_fields ) {
$options = new MonsterInsights_Frontend_Custom_Dimensions();
$options = $options->output_custom_dimensions( array () );
$ua = monsterinsights_get_ua_to_output( array( 'amp' => true ) );