Onsite API

The following APIs are called using window.KAMPYLE_ONSITE_SDK.API;. For example, window.KAMPYLE_ONSITE_SDK.loadForm(5); loads the form with formId number 5.

API Name

Provisioned

Description

updatePageView

-

Starts a new targeting session. Would probably be implemented in SPAs

stopLogger

onsiteLogger

Sets local storage variable mdLogger to FALSE.

Once turned off, logs are not collected.

startLogger

onsiteLogger

Sets local storage variable mdLogger to TRUE.

Once turned on, all logs are written to a private variable.

startInviteTargeting

isManuallyInviteTargeting

Usually targeting runs for all form types once the onsite script is loaded,

This feature prevents targeting for invite on load, and it is executed on demand by the customer using this API.

showForm(formId, options)

-

Loads and displays the specified form. Can pass an options object to the form

printMdigitalLogs

onsiteLogger

Prints all the logs collected from the moment startLogger API was called.

loadForm(formId)

-

Loads the specified form into view identified by its formId

isSurveyDisplayed

-

Returns true if there is an open survey (form) or intercept (invite)

closeForm(value)

Closes form/s based on the following values:

formId - Closes the specific form identified by the form ID.

all - Closes all open forms.

embedded - Closes all open embedded typed forms.

modal - Closes the open modal form, whether it is animation or lightbox.

Returns true if at least one form was closed.