hlxsites / danaher-ls-aem

AEM Franklin / Crosswalk site for DH Life Sciences
Apache License 2.0
3 stars 4 forks source link

[Solutions] Update Search Payload #881

Closed davidzochowski closed 7 months ago

davidzochowski commented 7 months ago

Need to update payload for Search Query. Add parseInt() to documentPosition value in Click analytics call

davidzochowski commented 7 months ago

Using https://stage.lifesciences.danaher.com/us/en/solutions/mabs/cell-line-development/products.html as an Example. This is what I expect the search payload to look like:

{
    "actionsHistory": [ // logic is the same as what getCoveoApiPayload() uses within header.js
        {
            "name": "Query",
            "time": "\"2024-03-08T16:23:24.210Z\""
        },
        {
            "name": "PageView",
            "time": "2024-03-08T16:23:22.913Z",
            "value": "/content/danaher/ls/us/en/search"
        }
    ],
    "analytics": {
        "actionCause": "interfaceLoad",
        "clientId": "4414778d-f983-4c99-a9ae-91a3a984fc6d", //just like with analytics call, if this is null, do not include
        "clientTimestamp": "2024-03-08T16:23:24.212Z", //time stamp of when the search call started
        "customData": {
            "context_workflow": //this is the workflow path,
            "context_host": "stage.lifesciences.danaher.com",
            "context_internal": false,
        },
        "documentReferrer": "https://stage.lifesciences.danaher.com/us/en/solutions/mabs/cell-line-development.html", //document.referrer
        "documentLocation": "https://stage.lifesciences.danaher.com/us/en/solutions/mabs/cell-line-development/products.html", //this is the current page
        "originContext": "DanaherLifeSciencesCategoryProductListing" //this is whatever we put for the originLevel1 in the analytics call
    },
    "aq": "@workflow==mabs|cell-line-development",
    "context": {
        "workflow": //this is the workflow path
        "host": "stage.lifesciences.danaher.com",
        "internal": false
    },
    "firstResult": 0, //this can be hardcoded
    "locale": "en", //this can be hardcoded
    "numberOfResults": 48, //this can be hardcoded
    "pipeline": "Danaher LifeSciences Category Product Listing", //this can be hardcoded
    "referrer": "https://stage.lifesciences.danaher.com/us/en/solutions/mabs/cell-line-development.html", //document.referrer,
    "searchHub": "DanaherLifeSciencesCategoryProductListing", // this can be hardcoded
    "tab": "Solutions", // this can be hardcoded
    "timezone": "America/New_York" // const userTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
}