Help with generating user engagement report

Hi,
We are looking for a report for our site (Izidok Academy) with the fileds – user id, object id, entry name and Total completion rate. My developer who is working on this is having trouble finding which object these fields are located in. Can you please help?

Hello,

From your description, I presume you want the TOP_USER_CONTENT report.
Basically, call report.getTable() with:

reportType=47 (TOP_USER_CONTENT)
reportInputFilter.userIds=$YOUR_USER_ID

You may pass several user IDs, separated by commas.

Note that since KMCng and the analytics app are both Angular apps, you can see all the API requests they make (including ones to the report API service) by opening a HTTP sniffer (you can use your browser’s Developer tools->Network).

A list of available report types can be found here: https://developer.kaltura.com/api-docs/General_Objects/Enums/KalturaReportType

The code for the analytics web I/F is FOSS and available here:


You may also find this helpful: https://developer.kaltura.com/workflows/Review_Media_Analytics/Analytics_Reports

Hello Jess,

As you mentioned the object id to use. I used that but I didnt get the data which I want.

I want the data are: User ID, Objcet ID, Object Name and Total Completion Rate. Check the attached screenshot.

User ID, Object Name Columns are missing. Can you pls let me know.

Hello,

Please provide your full code.

<?php $KALTURA_SESSION = get_session(); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://www.kaltura.com/api_v3/service/report/action/getTable'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, "ks=$KALTURA_SESSION&reportType=47&reportInputFilter[fromDate]=1572616080&reportInputFilter[toDate]=1595425680&reportInputFilter[objectType]=KalturaReportInputFilter&pager[pageSize]=50000000&pager[objectType]=KalturaFilterPager"); $headers = array(); $headers[] = 'Content-Type: application/x-www-form-urlencoded'; curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $result = curl_exec($ch); if (curl_errno($ch)) { echo 'Error:' . curl_error($ch); }else{ echo "res
";print_r($result); die; 
}

curl_close($ch);

function get_session(){
	$ch = curl_init();

	curl_setopt($ch, CURLOPT_URL, 'https://www.kaltura.com/api_v3/service/session/action/start');
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($ch, CURLOPT_POST, 1);
	curl_setopt($ch, CURLOPT_POSTFIELDS, "secret=02b2deb913bf67809205fed21ea8d33b&userId=boddetigautam@gmail.com&type=0&partnerId=2623162&expiry=86400&format=1");

	$headers = array();
	$headers[] = 'Content-Type: application/x-www-form-urlencoded';
	curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

	$result = curl_exec($ch);
	if (curl_errno($ch)) {
		return 'Error:' . curl_error($ch);
	}else{
		return json_decode($result);
	}
	
	curl_close($ch);
	
}
 
?>

Hi,

I’m not sure what the problem is? The user ID is a parameter you’re meant to pass to the report.getTable action. What do you mean by object name?

Also, as noted previously:

since KMCng and the analytics app are both Angular apps, you can see all the API requests they make (including ones to the report API service) by opening a HTTP sniffer (you can use your browser’s Developer tools->Network).

So you can see the exact requests the KMC analytics makes per view and make the same ones from your code.
Note further that we have official clients for PHP, no need to manually create these cURL requests. See https://developer.kaltura.com/api-docs/Client_Libraries

Hello Jess,

Before starting of the report. I got this below information to generate reports, so using that generated reports:

We need to pull a report which shows users engagement with each video (see attached as an example). This is a report which shows all users with each entry ID (video) that they have watched from November 1, 2019-June 25, 2020. We need to pull a new report like this - for the time period November 1,2019 to today. Can you do this?

The following is the documentation on the API we need to use –

https://developer.kaltura.com/workflows/Review_Media_Analytics/Analytics_Reports

Anyhow I am checking your reply and let you know if any doubts. Thank you

Hello Jess,

As I mentioned earlier that we need the data for the following:
User ID, Object ID & Total Completion Rate. So, can you please give the exact link to get the information?

So I can study and I will generate. You sent one link where it have lot of information to study which need more time.

As you already expert with this, you can know easily from where we can get this data. Pls let me know.

Hi Jess, This is Nish (earlier messages were from Gautam, my developer). Just to clarify, we need a report with the following fields:
user_id, object_id, entry_name, total_completion_rate
Someone on your end had generated this back in June. We need to do this monthly going forward but can’t seem to get user_id and object_id (and entry_name, which corresponds directly with object_id) in one report.
If you can share the code that was used in the past, that would be great.
Thanks

Hello,

Once more, here are the steps (I’m using the Kaltura CLI client in this example, the same can be done using any client):

  • Get a list of users:
kalcli -x report getTable reportType=13 reportInputFilter:objectType=KalturaEndUserReportInputFilter reportInputFilter:fromDay=20191101 reportInputFilter:toDay=20200727 pager:objectType=KalturaFilterPager pager:pageSize=500 ks=$FKS |grep data|sed 's@;@\r\n@g'|awk -F ',' '{print $1}' > /tmp/users
  • Get stats per user:
# headers:
echo "user_id,object_id,entry_name,creator_name,created_at,status,media_type,duration_msecs,entry_source,count_plays,count_loads,sum_time_viewed,avg_time_viewed,avg_completion_rate,total_completion_rate,avg_view_drop_off" > /tmp/engagement_report.csv

# write data per user:
while read KV; do kalcli -x report getTable reportType=47 reportInputFilter:objectType=KalturaEndUserReportInputFilter reportInputFilter:fromDay=20191101 reportInputFilter:toDay=20200727 pager:objectType=KalturaFilterPager pager:pageSize=500 reportInputFilter:userIds=$KV ks=$FKS|grep data|awk  -F "data" '{ print "'"$KV"'"","$2; }'|sed "s#;#\n$KV,#g";done < /tmp/users >> /tmp/engagement_report.csv

Cheers,