...
mopinion_ready
mopinion_will_show*
mopinion_shown*
mopinion_will_hide*
mopinion_hidden*
mopinion_next
mopinion_feedback_sent
mopinion_redirect
* Not available for embedded forms.
You can use an event listener to hear when a Mopinion event has taken place. You can then use the occurrence of an event to trigger your own script. With your own script you can, for example, log your feedback in the browser console or push the feedback to your own analytics program.
...
In the remaining part of this article, we provide for all 8 events scripts to log the event variables and values in the browser console, push the event variables and values in the Google Tagmanager Tag Manager dataLayer and how that will look in the console/dataLayer.
The events fired are as follows:
1. mopinion_ready
With this event, you know when a form is loaded, however not yet shown, on a page.
You can use the following JavaScript to display the events event's output in the browser's console:
...
Specific code to push the Event Object into the Google Tagmanager Tag Manager dataLayer:
Code Block |
---|
<script type="text/javascript"> document.addEventListener('mopinion_ready', function(e) { dataLayer.push(e.detail) }); </script> |
...
Code Block |
---|
{event: "ready", key: "[UNIQUE_FORM_KEY]", formName: "[FORM_NAME]"} |
2. mopinion_will_show
With this event, you know when the feedback button is clicked on.
You can use the following JavaScript to display the events event's output in the browser's console:
...
Specific code to push the Event Object into the Google Tagmanager Tag Manager dataLayer:
Code Block |
---|
<script type="text/javascript"> document.addEventListener('mopinion_will_show', function(e) { dataLayer.push(e.detail) }); </script> |
...
Code Block |
---|
{event: "will_show", key: "[UNIQUE_FORM_KEY]", formName: "[FORM_NAME]", triggerMethod: "[PASSIVE | PROACTIVE | EXIT]"} |
3. mopinion_shown
With this event, you know when the feedback form is shown.
You can use the following JavaScript to display the events event's output in the browser's console:
...
Specific code to push the Event Object into the Google Tagmanager Tag Manager dataLayer:
Code Block |
---|
<script type="text/javascript"> document.addEventListener('mopinion_shown', function(e) { dataLayer.push(e.detail) }); </script> |
...
Code Block |
---|
{event: "shown", key: "[UNIQUE_FORM_KEY]", formName: "[FORM_NAME]", triggerMethod: "[PASSIVE | PROACTIVE | EXIT]"} |
4. mopinion_will_hide
With this event, you know when the closing cross or an area outside of the feedback form is clicked on.
You can use the following JavaScript to display the events event's output in the browser's console:
...
Specific code to push the Event Object into the Google Tagmanager Tag Manager dataLayer:
Code Block |
---|
<script type="text/javascript"> document.addEventListener('mopinion_will_hide', function(e) { dataLayer.push(e.detail) }); </script> |
...
Code Block |
---|
{event: "will_hide", key: "[UNIQUE_FORM_KEY]", formName: "[FORM_NAME]", triggerMethod: "[PASSIVE | PROACTIVE | EXIT]"} |
5. mopinion_hidden
With this event, you know when the feedback form is hidden again.
You can use the following JavaScript to display the events event's output in the browser's console:
...
Specific code to push the Event Object into the Google Tagmanager Tag Manager dataLayer:
Code Block |
---|
<script type="text/javascript"> document.addEventListener('mopinion_hidden', function(e) { dataLayer.push(e.detail) }); </script> |
...
Code Block |
---|
{event: "hidden", key: "[UNIQUE_FORM_KEY]", formName: "[FORM_NAME]", triggerMethod: "[PASSIVE | PROACTIVE | EXIT]"} |
6. mopinion_next
If your feedback form consists of multiple pages this event, will let you know when navigation to a next page takes place. It also makes all the feedback given till until that point available.
You can use the following JavaScript to display the events event's output in the browser's console:
...
Specific code to push the Event Object into the Google Tagmanager Tag Manager dataLayer:
Code Block |
---|
<script type="text/javascript"> document.addEventListener('mopinion_next', function(e) { dataLayer.push(e.detail) }); </script> |
...
Code Block |
---|
{event: "next", feedback: Array(#_OF_OBJECTS) {id: "[UNIQUE_SURVEY_BLOCK_ID]", label: "[IMPORT_VAR]", title: "[QUESTION]", type: "[DATAFIELD_TYPE]", value: "[VALUE]" }, {id: "[UNIQUE_SURVEY_BLOCK_ID]", label: "[IMPORT_VAR]", title: "[QUESTION]", type: "[DATAFIELD_TYPE]", value: "[VALUE]" }, etc. {label: "User Agent", type: "agent", value: [BROWSER_USER_AGENT] }, {label: "url" type: "url" value: [URL_WHERE_THE_FORM_IS_SHOWN] }, {label: "Page title" type: "category" value: [PAGE_TITLE_WHERE_THE_FORM_IS_SHOWN] }, {label: "Role" type: "role" value: 1 }, {label: "Survey" type: "category" value: [FORMNAME] }, {label: "Viewport" type: "viewport" value: [LENGTH x WIDTH] }, {label: "Form trigger" type: "category" value: [PASSIVE | PROACTIVE | EXIT] }, {label: "Form completion percentage" type: "form_completion" value: [PERCENTAGE_OF_PAGES_COMPLETED] }, {label: "Customer ID" type: "customer" value: [UNIQUE_ID_GENERATED_ON_] }, {label: "Survey ID" type: "id" value: [UNIQUE_SURVEY_RESULT_ID] } key: "[UNIQUE_FORM_KEY]", formName: "[FORM_NAME]", triggerMethod: "[PASSIVE | PROACTIVE | EXIT]"} |
7. mopinion_feedback_sent
With this event, you know when the feedback form is completely submitted.
You can use the following JavaScript to display the events event's output in the browser's console:
...
Specific code to push the Event Object into the Google Tagmanager Tag Manager dataLayer:
Code Block |
---|
<script type="text/javascript"> document.addEventListener('mopinion_feedback_sent', function(e) { dataLayer.push(e.detail) }); </script> |
...
Code Block |
---|
{event: "feedback_sent", feedback: Array(#_OF_OBJECTS) {id: "[UNIQUE_SURVEY_BLOCK_ID]", label: "[IMPORT_VAR]", title: "[QUESTION]", type: "[DATAFIELD_TYPE]", value: "[VALUE]" }, {id: "[UNIQUE_SURVEY_BLOCK_ID]", label: "[IMPORT_VAR]", title: "[QUESTION]", type: "[DATAFIELD_TYPE]", value: "[VALUE]" }, etc. {label: "User Agent", type: "agent", value: [BROWSER_USER_AGENT] }, {label: "url" type: "url" value: [URL_WHERE_THE_FORM_IS_SHOWN] }, {label: "Page title" type: "category" value: [PAGE_TITLE_WHERE_THE_FORM_IS_SHOWN] }, {label: "Role" type: "role" value: 1 }, {label: "Survey" type: "category" value: [FORMNAME] }, {label: "Viewport" type: "viewport" value: [LENGTH x WIDTH] }, {label: "Form trigger" type: "category" value: [PASSIVE | PROACTIVE | EXIT] }, {label: "Form completion percentage" type: "form_completion" value: [PERCENTAGE_OF_PAGES_COMPLETED] }, {label: "Customer ID" type: "customer" value: [UNIQUE_ID_GENERATED_ON_] }, {label: "Survey ID" type: "id" value: [UNIQUE_SURVEY_RESULT_ID] } key: "[UNIQUE_FORM_KEY]", formName: "[FORM_NAME]", triggerMethod: "[PASSIVE | PROACTIVE | EXIT]"} |
8. mopinion_redirect
With this event, you know when a link within a feedback form is clicked and to what page is being redirected.
You can use the following JavaScript to display the events event's output in the browser's console:
...
Specific code to push the Event Object into the Google Tagmanager Tag Manager dataLayer:
Code Block |
---|
<script type="text/javascript"> document.addEventListener('mopinion_redirect', function(e) { dataLayer.push(e.detail) }); </script> |
...