Integrating Analytics with 3rd Party Systems
Storied provides a mechanism for integrating 3rd party systems with Storied appshell events using a simple callback mechanism.
1. Add a function called window.n2.analytics.event_callback to either the analytics footer or custom javascript section of project or account settings.
window.n2 = window.n2 || {}; window.n2.analytics = window.n2.analytics || {}; window.n2.analytics.event_callback = function(data) { console.log('triggering ' + data.event_type); if (data.event_type === 'n2_goal_achieved') { console.log('handeling goal event: ' + data.goal_name); var goalValues = data.goal_name.split(':'); var eventAction = goalValues[0]; var eventLabel = goalValues[1]; ga('send', 'event', 'Foto 1', eventAction, eventLabel); } };
2. Use the following event detail to capture and pass Storied event attributes to the desired 3rd party code.
Supported event types
n2_session_duration String
n2_page_view String
n2_link_visit String
n2_post_view String
n2_app_search String
n2_app_loaded String
n2_scroll_progress String
n2_goal_achieved String
n2_image_gallery_fullscreen String
n2_image_gallery_slide String
n2_image_gallery_play String
n2_image_gallery_pause String
n2_image_gallery_progress String
n2_image_gallery_end String
n2_smart_image_fullscreen String
n2_video_fullscreen String
n2_video_slide String
n2_video_play String
n2_video_pause String
n2_video_progress String
n2_video_end String
n2_tab_group_user_initiated String
n2_tab_group_autoplay String
Supported event types
image_gallery
smart_image
video
form
Supported widget actions
Fullscreen
Slide
Play
Pause
Progress
End
Submit
Data Common to all Events
app_url (optional) String
project_id (not required) String
customer_id (not required) String
n2_version (not required) String
n2_build_number (not required) String
page_type String
page_name String
page_url String
page_domain (optional) String
referrer String
referrer_domain (optional) String
client_id (optional) String
user_agent (optional) String
og_url (optional) String
session_id (optional) String
traffic_source (optional) String
location (optional) any
search_term (optional) String
event_type (optional) String
event_timestamp (optional) Number
page_view_id (optional) Boolean
isEmbedded Boolean
isFullpageEmbedded any
n2_app_loaded
app_loaded_duration Number
pix_chain String
n2_page_view
page_view_page_name String
pix_chain String
n2_page_view
post_view_feed_id String
post_view_provider_code String
post_view_slug String
pix_chain String
n2_smart_image_fullscreen, n2_video_play, n2_video_progress, n2_video_pause, n2_video_end, n2_image_gallery_slide, n2_image_gallery_play, n2_image_gallery_pause, n2_image_gallery_progress, n2_image_gallery_end, n2_tab_group_user_initiated, n2_tab_group_autoplay
widget_view_type WidgetType
widget_view_group_id String
widget_view_name String
widget_view_progress Number
widget_view_length Number
widget_view_item_id String
widget_view_item_url String
widget_view_item_progress Number
widget_view_item_action WidgetAction
widget_view_item_length Number
elementId String
n2_link_visit
link_visit_url String
link_visit_type String
n2_app_search
app_search_keyword any
app_search_category String
app_search_result_count Number
n2_scroll_progress
scroll_progress_type String
scroll_progress_value Number
n2_ctr
primary_event String
primary_event_value String
n2_dismiss
primary_event String
primary_event_value String
n2_goal_achieved
goal_name String
n2_session_duration
session_duration_length Number
n2_form_submit
form_name String
3. Example:
window.n2 = window.n2 || {}; window.n2.analytics = window.n2.analytics || {}; window.n2.analytics.event_callback = function(data) { console.log('triggering ' + data.event_type); if (data.event_type === 'n2_goal_achieved') { console.log('handeling goal event: ' + data.goal_name); var goalValues = data.goal_name.split(':'); var eventAction = goalValues[0]; var eventLabel = goalValues[1]; ga('send', 'event', 'Foto 1', eventAction, eventLabel); } };