Closed di-sukharev closed 5 months ago
ok, i see, it's only running with the window
being around https://github.com/reapziq/next-yandex-metrica/blob/main/src/lib/ym.ts
how can i call a setGoal from in a backend endpoint?
Hi! As far as I'm aware, Yandex Metrica does not provide any external API documentation, leaving communication through the JS Tag API as the sole documented option. However, you can use something like Plausible Analytics Events API as an alternative.
thanks <3
i use latest nextjs with the
/app
folder, can i callym(id, "reachGoal", "smth")
in a backend app route e.g./app/api/metrics/route.ts
? build fails when i call theym(.....)
in such an api route with this error, looks like it thinks it's a page:here is my function:
i then import it in e.g.
app/api/any_file.ts
likeimport { reachGoal } from "@/lib/yandex-metrics/reactGoal";
and it fails with the error when i runnext build