Methods

This article details methods the host page can use to interact with Reports API.

The following methods are accessed via the window.LearnosityReports object.

When the <script src="https://reports-va.learnosity.com"></script> tag is included on the page, the window.LearnosityReports object is instantiated, and ready for use.

LearnosityReports.init() method initializes Reports API and returns an instance of the application object (ReportsApp). This instance needs to be saved locally for future access to initialized reports.

Parameters
initObject
Type: object

See the Reports API initialization object for more information.

callbacks
Type: object

See the Reports API events during initialization for more information.

Returns: reportsApp

The following methods are accessed via the reportsApp object returned by window.LearnosityReports.init(). This object provides methods to interact with, and receive information relating to the reports placed on page.

ReportsApp.getReport() returns a Report object used for interacting with an initialized report, based on the id of the report provided in the request object.

Parameters
reportId
Type: string

The report ID provided in the request object when calling the LearnosityReports.init() method.

Returns: report

The following methods are accessed via the report object returned by reportsApp.getReport(). This object provides methods to interact with, and receive information for reports used.

Binds a callback function that will be invoked whenever the eventName is triggered.

Parameters
eventName
Type: string
Name of the event that you want to stop listening to

See Report specific events for more information.

eventCallback
Type: callback()
If no callback is provided, all event handlers for the eventName will be removed.

Subscribe to and control additional user IDs.

Important Only applicable to the live-activity-status-by-user report.

Parameters
userArray
Type: array[userObject]
Array of users to be added to the report.

Discard and terminate the test for the user IDs provided.

Important Only applicable to the live-activity-status-by-user report.

Parameters
userArray
Type: array[string]
Array of user_ids to be added to the report.

Save and terminate the test for the user IDs provided.

Important Only applicable to the live-activity-status-by-user report.

Parameters
userArray
Type: array[string]
Array of user_ids to be added to the report.

Submit and then exit the test for the user IDs provided.

Important Only applicable to the live-activity-status-by-user report.

Parameters
userArray
Type: array[string]
Array of user_ids to be added to the report.

Extend time (in seconds) for the test of the user IDs provided.

Important Only applicable to the live-activity-status-by-user report.

Parameters
userArray
Type: array[string]
Array of user_ids to be added to the report.
seconds
Type: number
number of seconds to extend the assessment timer by

Pause the test for the user IDs provided.

Important Only applicable to the live-activity-status-by-user report.

Parameters
userArray
Type: array[string]
Array of user_ids to be added to the report.

Unpause the test for the user IDs provided.

Important Only applicable to the live-activity-status-by-user report.

Parameters
userArray
Type: array[string]
Array of user_ids to be added to the report.

Each of the user IDs provided will navigate to the specified item.

The assessment will be automatically started if the student is still on the intro item.

The item is specified by reference (a string) or number (a 1-indexed number).

Important Only applicable to the live-activity-status-by-user report.

Parameters
userArray
Type: array[userObject]
Array of users to be added to the report.
itemObject
Type: object
object containing either an item_number or item_reference property.
Properties:
item_number
Type: number
item_reference
Type: string

Returns array of user_id strings for the currently selected users.

Important Only applicable to the live-activity-status-by-user report.

Returns: array[string]

Returns the group path currently displayed in the report..

Important Only applicable to the sessions-summary-by-group and activity-summary-by-group report.

Navigates the report to the given group path.

Important Only applicable to the sessions-summary-by-group and activity-summary-by-group report.

Parameters
groupPathObject
an object containing a reportPathArray.
var reportObject = reportsApp.getReport("activity-summary-by-group-report");
reportObject.viewGroup({"path": ["Simpson", "Springfield High"]});

Retrieves the raw JSON data for the specified group path and passes it to a callback.

Important Only applicable to the sessions-summary-by-group and activity-summary-by-group report.

Parameters
reportPathObject
Type: reportPathObject
callback
Type: function
function to be called once the data set has been fetched from Learnosity infrastructure.
Properties:
data
Type: object

See dataset JSON structure sample file for more information.

Sets options on the report. Used to modify or update the report's behavior after initialization.

Important Only applicable to the sessions-summary-by-group and activity-summary-by-group report.

Parameters
options
Type: object

Object containing options to configure UI and behaviour. Contains one or more of the below properties.

Properties:
always_show_group_ancestors
Type: boolean
Flag that specifies whether or not to display the ancestor rows for the current group.
columns
Type: array[object]
A definition of the columns that should be shown in the UI.

See column definitions for more information.

user_columns
Type: array[object]
A definition of the user-level columns that should be shown in the UI.

See column definitions for more information.

In the Method section above, there are some object definitions which are complex enough to document separately. These are listed below, and linked from the relevant documentation above.

object
an object containing the user information required to add that user to a live progress report.
Properties:
id
Type: string
the user id that should be tracked in this report. This is the same user_id used when initializing the Items API.
name
Type: string
the user name to be displayed in the UI.
hash
Type: string
a sha256 hash of the user_id and consumer secret.
array[String]
An array containing the group hierarchy path for this report. Shown as an array of strings in descending order.
object
an object containing a reportPathArray.
Properties:
path
Type: reportPathArray