# Platforce-API lib
Be sure to add the Platforce-api.js into each HTML file (slide):

As illustrated above, Platforce_MPA_home.html must contain
<script type="text/javascript" src="../../external/Platforce-api.js"></script>
Platforce-api.js has a list of methods to be used for standard and custom KPI:
- platforceInitMpaKpi(chapterId, slideId, slideName)—calls on slide HTML loaded event, to initialize the component monitoring for proper data collection. Pass the
chapterId,slideId,slideNamestring values with your current position on the presentation.
Example for the Platforce_MPA_home.html slide with the jQuery lib connected:
<script type="text/javascript" id="customs-js">
$(document).ready(function() {
platforceInitMpaKpi('main', 'Platforce_MPA_home', 'Home');
});
</script>
Platforce CRM uses its own two finger swipe system between slides in one chapter. So, if you have a linear-structured presentation with a list of slides, you can add them into one chapter.
To navigate from one slide in chapter A to another slide in chapter B, call:
platforceOpenChapterForPresentation(chapterId, slideId)—a method that redirects user to a new slide page, where
chapterIdandslideIdmust be IDs of the future chapter and slide that are also defined instrcuture.js.Example of the menu for each slide HTML file in the presentation:
<a id="home" onclick="platforceOpenChapterForPresentation('main', 'Platforce_MPA_home');"></a>
<a id="link1" onclick="platforceOpenChapterForPresentation('main', 'Platforce_MPA_guidelines');"></a>
<a id="link2" onclick="platforceOpenChapterForPresentation('main', 'Platforce_MPA_BD_and_Cal');"></a>
platforceTrackCustomData(label, value, options)—a method that allows you to track custom KPI data. Here:
label—a title or detailed information about what you collect.
value—the exact value to track.
options—additional information for custom data in JSON format.
Example of custom KPI tracking of the opening
ReferencesandPIpop-ups on the Platforce_MPA_home.html page:
<div id="btnA" onmousedown="platforceTrackCustomData('Ref clicked', true);"></div>
<div id="btnB" onmousedown="platforceTrackCustomData('PI clicked', true);"></div>