--- title: "getXGenPrediction()" slug: "getxgenprediction" updated: 2024-07-29T13:18:27Z published: 2024-07-29T13:18:27Z canonical: "docs.xgen.ai/getxgenprediction" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.xgen.ai/llms.txt > Use this file to discover all available pages before exploring further. # getXGenPrediction() getXgenPrediction() is used to retrieve a single list of XGen’s personalized recommendation predictions. These predictions are used for rendering out personalized elements that are unique to each user. This function gets a single element. If you want to retrieve more than one element, use [getXGenPredictions()](/v1/docs/getxgenpredictions) for a more efficient approach. > If the pages functionality is being used, this function will wait for a page to be matched before the promise resolves. #### Syntax ```javascript getXgenPrediction(elementId); ``` #### Parameters `elementId` **type:** `string` **description:** The ID of the element for the predictions that will be returned. #### Return Value A `promise` that resolves with an `array` of objects containing product information. Example: ![](https://cdn.us.document360.io/ae46ce4b-af2c-4789-b3ad-1d1ccd16b4a1/Images/Documentation/image(5).png) #### Examples ##### Get list of products: In this example, we get a list of products for a specific element. When the returned promise resolves, we console log the `prod_code` (aka `product ID`) of each product recommended. ```javascript // Create integration (use existing integration if you already created one) const integration = new XG(...config); // Get list of products for an element const products = await integration.getXgenPredictions('sm_el_b04ebc323ccb4f49bedcece7652e4fba'); // Console log prod_code of each product recommended products.forEach(product => console.log(product.prod_code)); ```