• Resolved nevesdeveloper

    (@nevesdeveloper)


    Hello. I have Content Egg plugin instaled, which allows me to create local 301 redirects for my affiliate products from amazon. When I had the amazon links, the plugin tracked the clicks to amazon fine. But now is not tracking the click on the local 301’s. Can you fix it? Thank you. Plugin is great, I love it, but now I can’t see who’s clicking to amazon (via a 301 local redirect – for example https://lummyshop.com/1234-asfnriu – that redirects to amazon), not seing the links clicked nor amazon final redirection.

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Jason Crouse

    (@coolmann)

    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 = "https://www.ThisIsTheRedirect.uri";
    
    $_stat[ 'outbound_resource' ] = redirectUrl;
    
    }
    
    return $_stat;
    }
    Plugin Author Jason Crouse

    (@coolmann)

    Thank you for sharing your solution. I am going to add it to our knowledge base for future reference.

    Best,
    Jason

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Not working with 301 redirects’ is closed to new replies.