Hi,
unfortunately there’s very little we can do in cases like this, since the redirect happens BEFORE the tracker kicks in and records the corresponding page view. What you could do is to edit the code that performs the 301 redirect to invoke Slimstat and pass all the parameters to record those page views in a way or another:
wp_slimstat::slimtrack();
Let me know if that solves your problem.
Jason
@coolmann
Thanks for the response… i have the same problem, can you maybe provide a small example? How do i pass the external url to which i want to redirect to slimtrack?
public static function slimtrack($_argument = '')
Is there am documentation of the $_argument’s structure? Is it possible to pass “$data_js” as an argument?
If i get it right i need to set somehow $data_js[‘res’] to the outbound url?
Thanks,
Julian
@coolmann
I found a solution for my problem… thanks for this awesome plugin!
@everyone who has the same problem:
i added this:
if(method_exists ('wp_slimstat', 'slimtrack'))
wp_slimstat::slimtrack();
before my redirect.
In my plugin i than implemented the filter:
add_filter( 'slimstat_filter_pageview_stat', 'my_redirect_pageview_stat' );
My implementation than checks if the resource is a redirect:
public function my_redirect_pageview_stat($_stat = array() ){
if(isset($_stat['resource']) && strpos($_stat['resource'], '/my/path/to/redirect/')===0){
//do stuff to get the actual url to redirect:
String redirectUrl = "http://www.ThisIsTheRedirect.uri";
$_stat[ 'outbound_resource' ] = redirectUrl;
}
return $_stat;
}
Thank you for sharing your solution. I am going to add it to our knowledge base for future reference.
Best,
Jason