- MoEngage highly recommends using the optional step for MoEngage Web SDK integration.
- SDK adheres to the MoEngage FUP policies. For more information, refer to the Fair Usage Policy.
Track Event
Tracking events records the user actions and the action properties. A single user action is recorded with every track_event call. MoEngage recommends that you make your event names human-readable so that everyone in your team can know what they mean instantly. You can track an event using track_event with the event name and the event characteristics such as attributes or properties.Event tracking using Google Tag Manager (GTM)
Use the described code in theCustom HTML Tag inside GTM. This Tag should be fired once per event and triggered on the elements where you wish to track website events. The event attributes can be picked up from GTM Data Layer.
Non-Interactive Event
Events that do not affect the session duration calculation in MoEngage Analytics are marked as Non-Interactive events. The following are considered non-interactive events:- Do not start a new session, even when the website is in the foreground
- Do not extend the session
- Do not have information on source and session
moe_non_interactive: 1 while tracking the event as described:
Callbacks on events tracked by SDK
There are few events which are tracked by SDK automatically for you and if you want to get those, then you can listen to the events as follows:List of events
- MOE_WEB_UNSUBSCRIBED
- EVENT_ACTION_WEB_SESSION_START
- MOE_PAGE_VIEWED
- MOE_WEB_OPTIN_BANNER_LOAD
- MOE_WEB_OPTIN_CLOSED
- MOE_WEB_OPTIN_ACCEPTED
- MOE_USER_SUBSCRIBED
- MOE_OPT_IN_SHOWN
- MOE_OPT_IN_ALLOWED
- MOE_OPT_IN_DISMISSED
- MOE_OPT_IN_BLOCKED
- MOE_LOGOUT
- MOE_ONSITE_MESSAGE_CLICKED
- MOE_ONSITE_MESSAGE_SHOWN
- MOE_ONSITE_MESSAGE_DISMISSED
- MOE_ONSITE_MESSAGE_AUTO_DISMISS
Troubleshooting
Event is not tracked on redirection when I am using window.open(..)
In case you are redirecting to another page usingwindow.open method and also tracking some event(s) on redirection then you need to wrap the window.open in a setTimeout. eg-
Events are not getting tracked when the page URL is very big
URL is tracked by default in all the events as an attribute. But the maximum length of the URL supported is 512 character. If the URL length exceeds that, then the whole events will be dropped. So make sure the URL length does not exceed 512 charactersPage Viewed event is not getting tracked on back/forward navigation
Your website might be eligible for bfcache. Back/forward cache (or bfcache) is a browser optimization that enables instant back and forward navigation. bfcache is an in-memory cache that stores a complete snapshot of a page (including the JavaScript heap) as the user is navigating away. Read more about bfcache here Thus the Moengage SDK does not re-initialises again and hence the page viewed events are not tracked. To include bfcache restores in your pageview count, set listeners for thepageshow event and check the persisted property.