Download

Documentation

Print This page

Analytify Filters

Analytify Filters narrow down the data you want to analyze in your WordPress website’s Google Analytics integration. These filters help you focus on specific segments of data and extract valuable insights.

Change Comparison Graph Color In Analytify Dashboard

We wrote a complete guide on how to change the graph color to match with your web design.

Hide The Navigation Tabs In Analytify’s Dashboard

In the following method, uncomment ( remove “//” ) from the items that you want to hide on Analytify’s dashboard page. Each item represents the name of the navigation tab.

/**
* Hide the navigation tabs from the Analytify dashboard.
*
* @param array $tab_items
* @return array
*/
function analytify_hide_dashboard_tabs_cb( $tab_items )
{
// Add the names of items you want to hide.
$hide_tabs = array(
// 'Forms Tracking',
// 'Events Tracking',
// 'Campaigns',
// 'Goals',
// 'WooCommerce',
// 'EDD',
// 'Authors',
// 'Demographics',
// 'Search Terms',
// 'Dimensions',
// 'Real-Time',
// 'Conversions',
// 'Acquisition',
// 'Monetization',
// 'Engagement',
);
return $hide_tabs;
}
add_filter( 'analytify_hide_dashboard_tabs', 'analytify_hide_dashboard_tabs_cb' );

Stop The Animation In Analytify’s Dashboard

In the following method, return false to stop the animation on the Analytify’s dashboard. The default value is true.

/**
* Control analytify dashboard header animation.
* Retrun true to play animation and false to prevent it.
*
* @param bool $condition
* @return bool
*/
function analytify_dashboard_head_animate_cb( $condition ) {
return false;
}
add_filter( 'analytify_dashboard_head_animate', 'analytify_dashboard_head_animate_cb' );

Change the “Go To Dashboard” Button’s URL in Email Report

Replace “your-url.com” in the following filter with your own URL.

/**
* Filter email report dashboarl url.
*
* @param string $url
* @return string
*/
function analytify_email_dashboard_url_cb( $url ) {
$url = 'your-url.com';
return $url;
}
add_filter( 'analytify_email_dashboard_url', 'analytify_email_dashboard_url_cb' );

Remove Analytify HTML Comments From Page Source Code View

Analytify includes opening and closing comments in the tracking code it adds to the page. If you want to remove those comments from the page, you can use this handy filter.

add_filter( 'analytify_tracking_code_comments', '__return_false' );

Customize Analytify Stats Cache Duration

Take control of the cache duration for Analytify stats with ease. By default, Analytify fetches new stats every 10 or 24 hours, depending on your settings. If you have enabled the “Delete Cache” option under Analytify -> Settings -> Dashboard, the cache time is set to 10 hours. Otherwise, it remains at 24 hours.

It is advisable not to set the cache time too low, as Google Analytics data typically updates within 10 to 24 hours.

You prefer a shorter cache time, you can utilize the following filter. Simply specify the desired duration in seconds, and the cache time will be adjusted accordingly.

function modify_analytify_stats_cache_time()
{
    $cache_time = 60*60*5; // Set the cache time to 5 hours in seconds
    return $cache_time;
}

add_filter('analytify_stats_cache_time', 'modify_analytify_stats_cache_time');

Set Custom Number of Rows Per Page of Top Cities Section in Analytify Dashboard Widget

We have introduced this new filter to set custom number of rows for the Top Cities Section within our Analytify dashboard widget. By default it just shows 5 top cities per page in the widget. Now you can show any number of rows on each page of the top cities section using the following filter. Here we have set the number of rows as 10 for example:

/**
 * Filter for setting the number of rows per page in Top Cities Section
 *
 *  @param $value
 *
 *  @return rows
 */
add_filter('analytify_widget_top_cities_per_page', static function ($value) {
	return $value = 10;
});

Set Custom Number of Rows Per Page of Top Countries Section in Analytify Dashboard Widget

We have introduced this new filter to set custom number of rows for the Top Countries Section within our Analytify dashboard widget. By default it just shows 5 top countries per page in the widget. Now you can show any number of rows on each page of the top countries section using the following filter. Here we have set the number of rows as 10 for example:

/**
 * Filter for setting the number of rows per page in Top Countries Section
 *
 *  @param $value
 *
 *  @return rows
 */
add_filter('analytify_widget_top_countries_filter', static function ($value) {
	return $value = 10;
});

Set Custom Number of Rows Per Page of Top Pages Section in Analytify Dashboard Widget

We have introduced this new filter to set custom number of rows for the Top Pages Section within our Analytify dashboard widget. By default it just shows 5 top pages per page in the widget. Now you can show any number of rows on each page of the top pages section using the following filter. Here we have set the number of rows as 10 for example:

/**
 * Filter for setting the number of rows per page in Top Pages by Views Section
 *
 *  @param $value
 *
 *  @return rows
 */
add_filter('analytify_widget_top_pages_by_views_filter', static function ($value) {
	return $value = 10;
});

Set Custom Number of Rows Per Page of Top Keywords Section in Analytify Dashboard Widget

We have introduced this new filter to set custom number of rows for the Top Keywords Section within our Analytify dashboard widget. By default it just shows 5 top keywords per page in the widget. Now you can show any number of rows on each page of the top keywords section using the following filter. Here we have set the number of rows as 10 for example:

/**
 * Filter for setting the number of rows per page in Top Keywords Section
 *
 *  @param $value
 *
 *  @return rows
 */
add_filter('analytify_widget_top_keywords_filter', static function ($value) {
	return $value = 10;
});

Set Custom Number of Rows Per Page of Top Referrals Section in Analytify Dashboard Widget

We have introduced this new filter to set custom number of rows for the Top Referrals Section within our Analytify dashboard widget. By default it just shows 5 top referrals per page in the widget. Now you can show any number of rows on each page of the top referrals section using the following filter. Here we have set the number of rows as 10 for example:

/**
 * Filter for setting the number of rows per page in Top Referrals Section
 *
 *  @param $value
 *
 *  @return rows
 */
add_filter('analytify_widget_top_refferals_filter', static function ($value) {
	return $value = 10;
});

Change Analytify Dashboard Graph Type (Line to Bar)

We have introduced another new filter to change the visitors/views graph type on your Analytify overview dashboard. By default the graph type is set as a line chart, but now you can use the following filter to change it to a bar graph if you want. It will display the graph in a bar chart format on your Analytify overview dashboard.

/**
 * Change dashboard graph type using this filter
 *
 * @var $type the type value can be line or bar
 */

add_filter(
	'analytify_comp_chart_graph',
	static function ( $type ) {
		return $type = 'bar';
	}
);

Show Users By Specific Role/s in Authors Tracking Dropdown Menu

We have introduced this new filter to show only users according to their specific roles in the authors dashboard for all their posts and stats respectively. By default the “Choose Author To View Stats” dropdown menu in the authors dashboard shows all of the user roles, but now you can show users by one or more specific user roles according to your requirement. After applying the filter, the drop down will display users only from your specified user role/s such as Administrator, Editor and/or Author etc.

/**
 * Display Author by specific role/s under dropdown menu
 *
 * @param $role The role can be Administrator, Editor, Author etc.
 *
 * @return user
 */

add_filter(
	'analytify_authors_dashboard_stat_roles',
	static function ( $role ) {
		return $role = array( 'Administrator', 'Editor', 'Author' );
	}
);

Display Number of Visitors by either Countries or Cities as Geographical Stats in Email Reports

We have introduced this new filter to show number of visitors either by countries or cities as part of geographical stats in the Analytify email reports. By default the geographical stats show visitors both by countries and cities, but now you can show visitors by a specific choice of Countries or Cities according to your requirement. Below are the both filters for specifying your choice by countries or cities respectively.  By applying the chosen filter, the email report will only include visitors from your chosen demographic for the geographic stats.


/**
 * Analytify filter to display only countries in geographical statistics in email report
 *
 * @param $display
 */
add_filter(
	'display_email_cities_table',
	static function ( $display ) {
		return $display = false;
	}
);

/**
 * Analytify filter to display only cities in geographical statistics in email report
 *
 * @param $display
 */
add_filter(
	'display_email_countries_table',
	static function ( $display ) {
		return $display = false;
	}
);

Custom Colors for the Analytify World Map on Post/Page

We have introduced another new filter to use custom colors for the Analytify world map on your posts or pages. By default the world map shortcode in Analytify has predefined colors in the display but now you can use the following filter to change its colors as you want. It will display the world map with your chosen custom colors on your posts or pages.

/**
 * Custom colors for the world map shortcode in Analytify.
 *
 * This filter allows users to define their choice of colors for the world map
 * shortcode in Analytify. The custom colors specified here will appear on the map.
 *
 * @param array $colors An array of colors to be applied to the world map.
 *
 * @return array An array of custom colors.
 */

add_filter(
	'analytify_world_map_shortcode_colors',
	function ($colors) {
		return ['#5555FF', '#00FF11', '#FF4444', '#FFFF88', '#FFFFFF'];
	}
);

We have introduced this new filter that lets you alphabetically arrange the quick links in the Analytify menu shown in the Admin toolbar. By default, the arrangement was random, but now you can use the following filter to sort the Analytify menu toolbar quick links in alphabetical order (A-Z) so that they can be displayed in a more organized way.

add_filter( 'wp_before_admin_bar_render', function( $items ) {

global $wp_admin_bar;

    // Get all current menu items
    $admin_bar_items = $wp_admin_bar->get_nodes();

    // Filter the items that start with 'analytify'
    $analytify_items = array_filter($admin_bar_items, function($item) {
        return strpos($item->id, 'analytify') === 0;
    });

    // Sort the filtered items alphabetically by title
    usort($analytify_items, function($a, $b) {
        return strcmp($a->title, $b->title);
    });

    // Remove the original analytify items from the admin bar
    foreach ($analytify_items as $item) {
        $wp_admin_bar->remove_menu($item->id);
    }

    // Re-add the anlaytify items in alphabetical order
    foreach ($analytify_items as $item) {
        $wp_admin_bar->add_menu((array) $item);
    }

} );

Show Visitors/Views Graph in the General Statistics Section of Analytify Dashboard Widget

We introduced this filter to enable the Visitors/Views graph shown in the General statistics section of the Analytify Widget, which is hidden by default. Apply this filter to show the graph when Analytify Pro is active.

add_filter( 'analytify_widget_graph_display_filter', '__return_true' );

If you have any doubts or questions related to this matter, please don’t hesitate to contact our support team.

Enjoy all time low prices and LIFETIME deal this BlackFriday season.
Buy Now 
close-image