Exclude internal traffic with cookie
-
How to exclude internal traffic with cookies?
Example: views are not counted, if the “internal_user” cookie is exists.
Edit:
{Feature request}Can you add an option to exclude traffic with cookies in WPP Tools?
Modified code:
(function(){ try { var wpp_json = document.querySelector("script#wpp-json"), do_request = true; wpp_params = JSON.parse(wpp_json.textContent); if ( wpp_params.ID ) { if ( '1' == wpp_params.sampling_active ) { var num = Math.floor(Math.random() * wpp_params.sampling_rate) + 1; do_request = ( 1 === num ); } if (document.cookie.match(RegExp('(?:^|;\\s*)internal_user=([^;]*)'))) { do_request = false; window.console.log('WPP: Internal traffic'); } if ( do_request ) { WordPressPopularPosts.post( wpp_params.ajax_url, "_wpnonce=" + wpp_params.token + "&wpp_id=" + wpp_params.ID + "&sampling=" + wpp_params.sampling_active + "&sampling_rate=" + wpp_params.sampling_rate, function( response ) { wpp_params.debug&&window.console&&window.console.log&&window.console.log(JSON.parse(response)); } ); } } } catch (err) { console.error("WPP: Couldn't read JSON data"); } })();
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Exclude internal traffic with cookie’ is closed to new replies.