JavaScript API


The tracking code included on your page adds a seaurchinIO(<action>, <data>) function to the window scope. This function serves as the interface between your page and the SeaUrchin.IO data capture logic.


seaurchinIO('init', <your app id>);

Initialize the tracking code. This will result in an async request for the app's config data. Only the first "init" call made on a page will take effect.


Use the identify call to optionally tag a session with the user's unique identifier and any set of custom properties. This call can be invoked multiple times per session. In case of conflicts, the last value set for each property is used.

These properties will be added to matching search interactions in the data export.


seaurchinIO('identify', <key value map>);


seaurchinIO('identify', {
    "user_id": "12345",
    "custom_property": "custom value"

Custom Logging

This section is for advanced scenarios that fall outside of the auto capture capabilities. Most implementations will not need to leverage these API calls. For code-less configurations, see the auto capture instructions.


seaurchinIO('optout', true | false);

Opt out of SeaUrchin.IO tracking. The browser making this call will be excluded from all SeaUrchin.IO tracking on the domain the call was made from.


seaurchinIO('log', <event data>);

Manually log an event. See the "Data Format" section below for more details.

Data Format

The document below details the JSON structure SeaUrchin.IO uses to represent search event data. When using the manual logging feature, the data passed to seaurchinIO('log', <data>) should conform to this format.

Search event

fflow idnumber
e"s"event type
susearch urlstring
sqsearch querystring
sosearch offset / pagenumber -- later pages should have higher numbers
sfsearch facetsJSON object containing facet: [values] mappings
sdsearch durationnumber in milliseconds

Result display event

fflow idnumber
e"d"event type
diresult container idgenerated uuid string
dtresult container top offsetnumber -- used to calculate result ordering (items higher up should have smaller values than those below)
dlresult container left offsetnumber -- used to calculate result ordering (items on the left should have smaller values than those on the right)
dcresult titlestring
duresult urlstring
dpresult pricestring (null if not applicable)

Result click event

fflow idnumber
e"c"event type
ciresult container idgenerated uuid string -- should match id of the corresponding display event
ccresult titlestring
curesult urlstring

Item page view event

fflow idnumber
e"i"event type
iuitem page urlstring
itdwell time on page in millisecondsnumber

Goal -- set items event

fflow idnumber
e"f"event type
figoal idnumber
faarray of associated item objectsitem object -- { name: <name (string)>, url: <url (string)>, quantity: <quantity (string)>, price: <unit price (string)> }
fsorder subtotalstring

Goal -- conversion event

fflow idnumber
e"g"event type
gigoal idnumber -- should match id of the corresponding goal set items event
Can't find what you're looking for? Send an email to