Widget
Requirements
Key | Required | Description |
---|---|---|
Widget ID | always | Used to serve up your widget experience to your users |
Iframe
<iframe src=”https://www.pymetrics.com/embeddable/widget/<widget_id>/” frameborder="0"></iframe>
Please replace the widget_id
variable with your Widget ID given to you by pymetrics.
Style
An example of the widget can be found at https://www.pymetrics.com/embeddable/test/
User Login
SAML Login
An example of the pymetrics SP metadata can be found https://www.pymetrics.com/saml2-sp/demo/demo/metadata/.
Events
You may do so by implementing the following javascript code on the page that contains the widget:
// Create IE + others compatible event handler
var eventMethod = window.addEventListener ? "addEventListener" : "attachEvent";
var eventer = window[eventMethod];
var messageEvent = eventMethod == "attachEvent" ? "onmessage" : "message";
// Listen to message from child window
eventer(messageEvent,function(e) {
console.log('parent received message!: ', e.data);
// do what you want depending on the event that got sent from the widget
},false);
Value | Description |
---|---|
pymetrics.widget.login | User logs into the widget using the pymetrics authentication system |
pymetrics.widget.register | User signs up (this will be followed by a "pymetrics.widget.login" action) |
pymetrics.widget.initialize | User is authenticated (pymetrics auth/SAML/Oauth) and enters logged-in widget state |
pymetrics.widget.played_game | User has completed playing a game |
pymetrics.widget.completed_games | User has completed all required games, and their results have started to calculate |
pymetrics.widget.navigate.* | User has navigated to a state within the widget (for example, pymetrics.widget.navigate.main.games or pymetrics.widget.navigate.main.traits) |