Retrieve Synthetic Users Segmentation
Before you start, please create a helpdesk ticket to activate the enrichment endpoint on your JENTIS Platform.
Understanding user behavior is key to enhancing the customer experience, and JENTIS provides a powerful way to do just that when using Synthetic Users.
JENTIS provides a function within the jentisApp
namespace to directly access the enrichment interface from the browser environment. When an active Synthetic Users model is running, you can access the JENTIS User's segmentation via this interface and gain more information about that segment - behavioral or demographics, for example.
In this article, we’ll explain how to retrieve Synthetic Users' segmentation data, explain the code behind it, and how to access the response data.
Retrieve Synthetic User Segmentation
To retrieve this information, integrate the following code into your website:
window.jentisApp.getEnrichmentData(
"enrichment.idpooling",
{
"container": window.jentis.config.account,
"userId": window.jentis.tracker.readDocumentID("user")
},
["enrich_idpooling_segment"],
function(data) {
// Callback function triggered when data is received
}
);
Explanation of the Code
Parameters:
"enrichment.idpooling"
: Specifies the enrichment type to query.Configuration object:
"container"
: The account container from the JENTIS configuration."userId"
: The user ID retrieved usingjentis.tracker.readDocumentID("user")
.
["enrich_idpooling_segment"]
: The specific enrichment data to request.Callback Function:
This function is executed when the data is returned from the enrichment interface. The received data will be passed as an argument to the callback.
Response Example
If the operation is successful, the following response will be returned:
'{"enrichment.idpooling":{"enrich_idpooling_segment":["5"]}}'
Accessing the Data
To work with the response data, use JSON.parse()
to convert the returned string into a JavaScript object for direct access:
const response = '{"enrichment.idpooling":{"enrich_idpooling_segment":["5"]}}';
const parsedData = JSON.parse(response);
console.log(parsedData.enrichment.idpooling.enrich_idpooling_segment); // Output: ["5"]
This process seamlessly integrates Synthetic User segmentation data into your application.
If you have any questions or suggestions, contact us through our Helpdesk.