You can push any error messages to Google Analytics with event tracking.
I use Google Tagmanager so my code is different than whatever flavor of Analytics you may use but you get the idea.
I also noticed that g.screen variable does not necessarily display the screen template, it displays the value that g.screen was set to in the forms hidden input. So for example, errors on the OPAY page will be in the eventCategory of 'INVC'.
If that bothers you then you can create a hidden input for g.PrevScreen and use that for the eventCategory instead.
Code:
<mvt:if expr="l.settings:messages:error_message_count">
<div class="global-message-container">
<mvt:foreach iterator="error" array="messages:error_messages">
<div class="global-error-message">&mvt:error;</div>
<script type="text/javascript">
dataLayer.push({'event': 'GAevent', 'eventCategory' : 'error_&mvte:global:screen;', 'eventAction' : 'error', 'eventLabel' : '&mvt:error;'});
</script>
</mvt:foreach>
</div>
</mvt:if>
<mvt:if expr="l.settings:messages:information_message_count">
<div class="global-message-container">
<mvt:foreach iterator="message" array="messages:information_messages">
<div class="global-info-message">&mvt:message;</div>
</mvt:foreach>
</div>
</mvt:if>
I use Google Tagmanager so my code is different than whatever flavor of Analytics you may use but you get the idea.
I also noticed that g.screen variable does not necessarily display the screen template, it displays the value that g.screen was set to in the forms hidden input. So for example, errors on the OPAY page will be in the eventCategory of 'INVC'.
If that bothers you then you can create a hidden input for g.PrevScreen and use that for the eventCategory instead.
Comment