Support » Plugin: WP Statistics » Record urls without parameters

Viewing 2 replies - 1 through 2 (of 2 total)
  • function wp_statistics_get_uri() {
    		// Get the site's path from the URL.
    		$site_uri = parse_url( site_url(), PHP_URL_PATH );
    
    		// Get the current page URI.
    		$page_uri = $_SERVER["REQUEST_URI"];
    
    		// Strip the site's path from the URI.
    		$page_uri = str_ireplace( $site_uri, '', $page_uri );
    
    		// If we're at the root (aka the URI is blank), let's make sure to indicate it.
    		if( $page_uri == '' ) { $page_uri = '/'; }
    
    		return strtok( $page_uri, '?' );
    	}
    Plugin Contributor Greg Ross

    (@gregross)

    The problem with that option is that sometimes a page changes behaviour based on the parameters, in fact the default settings for WordPress’s permalink uses parameters to distinguish pages.

    When I wrote the code I did consider doing this but didn’t implement it due to the issues it would bring up.

    I’ll look to adding it as an option in the next release, off by default, with some warning around it and perhaps a check to see if the permalink setting uses it.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Record urls without parameters’ is closed to new replies.