How can we get the Metrics event data?

Hi,

I’ve been looking at your docs for the Metrics plugin (metrological-sdk/metrics.md at master · Metrological/metrological-sdk · GitHub).

It documents the automated/manual Metrics methods and these events get displayed in the console Log as they get fired.

Is there a way to get hold of these automated app and video Metric event values that are fired into the Logs, so we can then also send them to our backend? Or is there another preferred way to get the Metrics data?

Thanks in advance,
L

Hi Lew,

Let me start by saying that you’re probably best of asking this question to the folks at Metrological, who are now (as of Lightning-SDK v5) maintaining this plugin. Either by opening a ticket at the metro-sdk repo, or by contacting their dev support channel. They will also be able to tell you exactly how this may (or may not) work in the context of the Metrological store (if that’s where you’re hosting your App).

But to already give you some idea: these are the lines of code responsible for logging the events during development: metrological-sdk/index.js at master · Metrological/metrological-sdk · GitHub

You’ll also see that whenever a sendMetric-method is provided in the config during initialization of the app, it overrides the default one (that only logs). The Metrological store provides this sendMetric function automatically. I’m not sure if that function allows you to tap into it, you’d have to check that with Metrological platform team, but technically that should be possible

If you self host, you would be able to provide a custom sendMetric function to do whatever you want to do. Note this would only work with the lng dist version of your app, as you can’t specify a function in your settings.json (the one that used during lng dev).

Hope this helps.

-Michiel

1 Like

Many thanks for the info Michiel