• Resolved hippoosupport

    (@hippoosupport)


    Hello,

    It seems that the following endpoint:
    example.com/wp-json/koko-analytics/v1/stats
    is returning a “500 Internal Server Error.”

    We have deactivated all other plugins, but it appears that there might be an issue specifically with the Koko Analytics REST API.

    We are reviewing the plugin’s API, and if it works well, we plan to make one integration with our Hippoo WooCommerce app.

    We would greatly appreciate it if you could check and resolve the issue at your earliest convenience.

    Thank you for your support!

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author Danny van Kooten

    (@dvankooten)

    Hello @hippoosupport,

    Thanks for bringing that issue to our attention – you’re absolutely right, something was broken in our plugin. The fix will be included in the next plugin release, but for now you can also bypass it by passing a valid start_date parameter in the URL.

    For example: example.com/wp-json/koko-analytics/v1/stats?start_date=2024-12-01

    Best,
    Danny

    PS. Hippoo looks really slick. Nice job!

    Thread Starter hippoosupport

    (@hippoosupport)

    Thanks so much, it works well with the trick you said.

    I wanted to kindly inquire if it would be possible to add an additional authentication method for accessing the API via WooCommerce REST API keys. This change would help improve our integration process.

    Currently, Hippoo accesses data using WooCommerce authentication keys, but since Koko uses a different method, it has been challenging to integrate.

    We would greatly appreciate your consideration of this enhancement, as it would make the process much more manageable on our end. Thank you so much for your time and support!

    Looking forward to your feedback.

    Plugin Author Danny van Kooten

    (@dvankooten)

    Hi @hippoosupport,

    I don’t really see us adding support for WooCommerce authentication keys explicitly, but a filter hook on the permission_callback is probably a good idea!

    Note that you can already accomplish a similar thing by doing something like this:

    For REST requests with a valid WooCommerce auth key provided, add a filter hook on koko_analytics_settings and set is_dashboard_public to 1.

    Example:

    // Note: dummy code, replace with proper authorization check using WooCommerce Auth Keys
    if (REST_REQUEST && woocommerce_authorize_request()) {
    add_filter('koko_analytics_settings', function ($settings) {
    $settings['is_dashboard_public'] = '1';
    return $settings;
    });
    }

    As long as the code above runs before rest_api_init then this should also authorize requests using a WooCommerce Auth Keys.

    But again, I agree that a filter hook on/in the REST authorization callback sounds nice so we’ll probably add that.

    Best,
    Danny

    Thread Starter hippoosupport

    (@hippoosupport)

    Thanks so much, Danny.

    Super helpful.

    Thread Starter hippoosupport

    (@hippoosupport)

    Apologies for coming back to you with another question.

    First of all, thank you for the update! We’re happy to see the previous issue has been resolved.

    That said, we have a question regarding this URL:
    https://dev.hippoo.app/wp-json/koko-analytics/v1/realtime

    It seems this one is still broken. Could you please check?

    <br />

    <b>Deprecated</b>: strtotime(): Passing null to parameter #1 ($datetime) of type string is deprecated in <b>/var/www/html/dev.hippoo.app/public_html/wp-content/plugins/koko-analytics/src/functions.php</b> on line <b>145</b><br />

    1
    Plugin Author Danny van Kooten

    (@dvankooten)

    Hi @hippoosupport,

    Thanks – nice catch again. Will fix! Until then you can bypass it by explicitly passing a since parameter.

    Example: GET /wp-json/koko-analytics/v1/realtime?since=-10+minutes

    since can be a relative time string that strtotime() understands, or a Unix timestamp.

    Thread Starter hippoosupport

    (@hippoosupport)

    Hello Danny,

    Just wanted to let you know that it seems there is an issue with the recent update, allowing access to the stats without requiring authentication.

    https://dev.hippoo.app/wp-json/koko-analytics/v1/stats

    Plugin Author Danny van Kooten

    (@dvankooten)

    Hi @hippoosupport,

    Ugh, thanks for the heads up. I ended up accidentally pushing something which I only added for testing one of my previous comments in this thread. Fix is going out right away!

    Thread Starter hippoosupport

    (@hippoosupport)

    Hi there,

    We’ve discovered another issue in the REST API.

    For example, when we request the following endpoint:

    /koko-analytics/v1/stats?start_date=2025-01-01&end_date=2025-01-15&monthly=false

    Even though "monthly=false", we are still receiving cumulative monthly numbers.

    Could you please make a quick fix to resolve this issue?

    Thanks so much!

    Plugin Author Danny van Kooten

    (@dvankooten)

    Hello @hippoosupport,

    Can you try using 0 as the value for the monthly query parameter, please?

    /koko-analytics/v1/stats?start_date=2025-01-01&end_date=2025-01-15&monthly=0

    We’ll push an update so that you can supply false value as well, but until then this should do the trick.

    Best,
    Danny

    Thread Starter hippoosupport

    (@hippoosupport)

    Hello Koko Analytics team,

    We’re excited to share that we’ve integrated Koko Analytics into our Hippoo WooCommerce app!

    Store owners can now track their website analytics directly within Hippoo, making it easier to gain insights without need to come to WordPress dashboard. We’ve written about this integration here:
    Track Your WooCommerce Store Analytics with Hippoo & Koko Analytic

    If possible, we’d love for you to feature this integration on your website so more users can discover and benefit from it.

    Additionally, if you have any other plugins that you think would be valuable for integration, we’d love to explore the possibilities. Let us know your thoughts!

    Thanks,

    Plugin Author Danny van Kooten

    (@dvankooten)

    @hippoosupport Nice, that looks sleek! I’ve just shared it on my social media accounts and plan to write about your integration on the Koko Analytics blog as well. Nicely done!

Viewing 12 replies - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.