Plugin Framework - Heap Event Message Schema

šŸš§

Be cautious when modifying event messages

Within this document, we will be sharing a subset of the properties on our event messages. When implementing a transformer, there may be additional properties not detailed in this document.

Avoid modifying these properties as they may be vital for Heap analysis

Base Event Message Scheme

PropertyTypeDescription
id (do not modify)stringrequired
unique numerical string identifier for an event
type (do not modify)stringrequired
event type associated with the message

- metadata user event: meta_user
- metadata session event: meta_session
- metadata pageview event: meta_pageview
- track event: core_track
info (do not modify)objectrequired
raw event information used for event message data construction
dataEventMessagerequired
message constructed by transformers to be sent to Heap

All event messages will be structured as noted above. In particular, data is where any modifications to the event payload should occur. We have 4 types of EventMessage which will be detailed in the subsequent sections:

Track Event Message Schema

PropertyTypeDescription
id (do not modify)stringrequired
unique numerical string identifier for the interaction event
time (do not modify)numberrequired
start timestamp of the pageview
pageview_info PageviewInforequired
information associated with the current pageview
session_infoSessionInforequired
information associated with the current session
event.interactionInteractionMessageoptional
information about the interaction event, if applicable

- captured for change, click, and submit events
event.customCustomMessageoptional
information about the manual track event, if applicable

- captured for heap.track events
propertiesobjectoptional
custom pageview properties.

- key must be a string
- value must be a string, number, boolean, or number

Example Interaction Track Event Message (click)

{
   "id":"4862784210443237",
   "type":"core_track",
   "data":{
      "id":"4862784210443237",
      "time":1695772367625,
      "env_id":"2448354216",
      "user_id":"6772334287318949",
      "base_library":{
         "name":"web",
         "version":"5.0",
         "platform":"web"
      },
      "device":{
         "user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36",
         "uach":{
            "model":"",
            "platform_version":"12.3.0",
            "browser_version":"116.0.5845.187"
         }
      },
      "session_info":{
         "time":1695771981608,
         "referrer":"",
         "id":"4648187408605516",
         "search_keyword":"",
         "utm":{
            "source":"",
            "medium":"",
            "term":"",
            "content":"",
            "campaign":""
         },
         "initial_pageview_info":{
            "time":1695771981608,
            "id":"3495395863577351",
            "title":"",
            "url":{
               "domain":"jamesnghiem.github.io",
               "path":"/redirect-test/",
               "query":"?test=1234",
               "hash":""
            },
            "source_properties":{
               "screen_height":879,
               "screen_width":1262
            }
         }
      },
      "pageview_info":{
         "time":1695771981608,
         "id":"3495395863577351",
         "url":{
            "domain":"jamesnghiem.github.io",
            "path":"/redirect-test/",
            "query":"?test=1234",
            "hash":""
         },
         "title":"",
         "source_properties":{
            "screen_height":879,
            "screen_width":1262
         }
      },
      "event":{
         "interaction":{
            "kind":"BUILTIN_KIND_CLICK",
            "hierarchy":"@h2;|",
            "nodes":[
               {
                  "tagName":"h2",
                  "id":null,
                  "classes":[],
                  "attributes":[],
                  "heapRedactedAttributes":[],
                  "targetText":"for ted"
               }
            ]
         }
      },
      "source_library":{
         "name":"autotrack",
         "version":"0.0.0"
      }
   }
}

Example Custom Track Event Message

{
   "id":"6593488158485448",
   "type":"core_track",
   "info":{
      "event":"custom track event",
      "properties":{
         "isCustom":true,
         "date":"9/26/2023"
      },
      "isAutotrack":false
   },
   "data":{
      "id":"6593488158485448",
      "time":1695772229848,
      "env_id":"2448354216",
      "user_id":"6772334287318949",
      "base_library":{
         "name":"web",
         "version":"5.0",
         "platform":"web"
      },
      "device":{
         "user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36",
         "uach":{
            "model":"",
            "platform_version":"12.3.0",
            "browser_version":"116.0.5845.187"
         }
      },
      "session_info":{
         "time":1695771981608,
         "referrer":"",
         "id":"4648187408605516",
         "search_keyword":"",
         "utm":{
            "source":"",
            "medium":"",
            "term":"",
            "content":"",
            "campaign":""
         },
         "initial_pageview_info":{
            "time":1695771981608,
            "id":"3495395863577351",
            "title":"",
            "url":{
               "domain":"jamesnghiem.github.io",
               "path":"/redirect-test/",
               "query":"?test=1234",
               "hash":""
            },
            "source_properties":{
               "screen_height":879,
               "screen_width":1262
            }
         }
      },
      "pageview_info":{
         "time":1695771981608,
         "id":"3495395863577351",
         "url":{
            "domain":"jamesnghiem.github.io",
            "path":"/redirect-test/",
            "query":"?test=1234",
            "hash":""
         },
         "title":"",
         "source_properties":{
            "screen_height":879,
            "screen_width":1262
         }
      },
      "event":{
         "custom":{
            "name":"custom track event",
            "properties":{
               "isCustom":true,
               "date":"9/26/2023"
            }
         }
      }
   }
}

Custom Message

PropertyTypeDescription
namestringrequired
name of the custom track event

- first argument of heap.track
propertiesobjectoptional
custom track event properties

- second argument of heap.track

Interaction Message

PropertyTypeDescription
hierarchystringrequired
DOM hierarchy string associated with the interaction event
nodesArray<ElementNode>required
Node representation of the hierarchy

- begins with the target element and traverses upwards

Element Node

šŸš§

Only modifications to the targetText will be persisted. Modifications to any other property will not change the captured hierarchy string.

PropertyTypeDescription
tagNamestringrequired
tag of the element node
idstringrequired
id of the element node
classesArray<string>required
list of the element's class names
attributesArray<HTMLAttribute>required
list of the element's attributes
hrefstringoptional
href of the element node
targetTextstringoptional
text of the element node

- this is only captured for the target element (first
ElementNode of the array)

Metadata Event Message Schema

User Message

PropertyTypeDescription
id (do not modify)stringrequired
unique numerical string identifier for the user
time (do not modify)numberrequired
start timestamp of the user
userUserInforequired
information associated with the current user

Example User Metadata Event Message

{
   "type":"meta_user",
   "id":"6772334287318949",
   "data":{
      "time":1695771981608,
      "id":"6772334287318949",
      "user_id":"6772334287318949",
      "base_library":{
         "name":"web",
         "version":"5.0",
         "platform":"web"
      },
      "device":{
         "user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36",
         "uach":{
            "model":"",
            "platform_version":"12.3.0",
            "browser_version":"116.0.5845.187"
         }
      },
      "env_id":"2448354216",
      "user":{
         "time":1695771981608,
         "id":"6772334287318949",
         "initial_session_info":{
            "referrer":"",
            "time":1695771981608,
            "id":"4648187408605516",
            "search_keyword":"",
            "utm":{
               "source":"",
               "medium":"",
               "term":"",
               "content":"",
               "campaign":""
            },
            "initial_pageview_info":{
               "time":1695771981608,
               "id":"3495395863577351",
               "url":{
                  "domain":"jamesnghiem.github.io",
                  "path":"/redirect-test/",
                  "query":"?test=1234",
                  "hash":""
               },
               "source_properties":{
                  "screen_height":879,
                  "screen_width":1262
               }
            }
         }
      }
   }
}

Session Message

PropertyTypeDescription
id (do not modify)stringrequired
unique numerical string identifier for the session
time (do not modify)numberrequired
start timestamp of the user
session_infoSessionInforequired
information associated with the current session

Example Session Metadata Event Message

{
   "type":"meta_session",
   "id":"4648187408605516",
   "data":{
      "time":1695771981608,
      "id":"4648187408605516",
      "env_id":"2448354216",
      "user_id":"6772334287318949",
      "base_library":{
         "name":"web",
         "version":"5.0",
         "platform":"web"
      },
      "device":{
         "user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36",
         "uach":{
            "model":"",
            "platform_version":"12.3.0",
            "browser_version":"116.0.5845.187"
         }
      },
      "session_info":{
         "time":1695771981608,
         "referrer":"",
         "id":"4648187408605516",
         "search_keyword":"",
         "utm":{
            "source":"",
            "medium":"",
            "term":"",
            "content":"",
            "campaign":""
         },
         "initial_pageview_info":{
            "time":1695771981608,
            "id":"3495395863577351",
            "title":"",
            "url":{
               "domain":"jamesnghiem.github.io",
               "path":"/redirect-test/",
               "query":"?test=1234",
               "hash":""
            },
            "source_properties":{
               "screen_height":879,
               "screen_width":1262
            }
         }
      },
      "session":{}
   }
}

Pageview Message

PropertyTypeDescription
id (do not modify)stringrequired
unique numerical string identifier for the pageview
time (do not modify)numberrequired
start timestamp of the user
pageview_infoPageviewInforequired
information associated with the current pageview

Example Pageview Metadata Event Message

{
   "type":"meta_pageview",
   "id":"6899501780283694",
   "data":{
      "time":1695771155484,
      "id":"6899501780283694",
      "env_id":"2448354216",
      "user_id":"3251430901129913",
      "base_library":{
         "name":"web",
         "version":"5.0",
         "platform":"web"
      },
      "device":{
         "user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36",
         "uach":{
            "model":"",
            "platform_version":"12.3.0",
            "browser_version":"116.0.5845.187"
         }
      },
      "session_info":{
         "time":1695770971484,
         "referrer":"",
         "id":"5490251667124630",
         "search_keyword":"",
         "utm":{
            "source":"",
            "medium":"",
            "term":"",
            "content":"",
            "campaign":""
         },
         "initial_pageview_info":{
            "time":1695770971484,
            "id":"8057529591957585",
            "title":"",
            "url":{
               "domain":"jamesnghiem.github.io",
               "path":"/strict-csp/",
               "query":"",
               "hash":""
            },
            "source_properties":{
               "screen_height":879,
               "screen_width":1728
            }
         }
      },
      "pageview_info":{
         "time":1695771155484,
         "id":"6899501780283694",
         "url":{
            "domain":"jamesnghiem.github.io",
            "path":"/redirect-test/",
            "query":"",
            "hash":""
         },
         "title":"",
         "source_properties":{
            "screen_height":879,
            "screen_width":849
         }
      },
      "pageview":{}
   }
}

Shared Property Schema

User Information

PropertyTypeDescription
id (do not modify)stringrequired
unique numerical string identifier for the user
time (do not modify)numberrequired
start timestamp of the user
identity(do not modify) stringoptional
identity of the user
initial_session_infoSessionInfooptional
information associated with the first session of the user

Session Information

PropertyTypeDescription
id (do not modify)stringrequired
unique numerical string identifier for the session
time (do not modify)numberrequired
start timestamp of the session
referrer stringoptional
page linking to the site that initiated the session
search_keywordstringoptional
search keyword of the referrer
utm.sourcestringoptional
UTM source parameter of the first page of the session
utm.mediumstringoptional
UTM medium parameter of the first page of the session
utm.termstringoptional
UTM term parameter of the first page of the session
utm.contentstringoptional
UTM content parameter of the first page of the session
utm.campaignObjectoptional
UTM campaign parameter of the first page of the session
initial_pageview_infoPageviewInfooptional
information associated with the first pageview of the session

Pageview Information

PropertyTypeDescription
id (do not modify)stringrequired
unique numerical string identifier for the pageview
time (do not modify)numberrequired
start timestamp of the pageview
title stringoptional
title of the page
url.domainstringoptional
domain of the pageview URL
url.pathstringoptional
path of the pageview URL
url.querystringoptional
query parameters of the pageview URL
url.hashstringoptional
hash fragment of the pageview URL
previous_pagestringoptional
previous page path visited in this session
propertiesObjectoptional
custom pageview properties

- key must be a string
- value must be a string, number, boolean, or number