> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # GetSemanticModel # Package: analytics # Namespace: SemanticModelsService # Method link: https://dev.wix.com/docs/api-reference/business-management/analytics/semantic-models/get-semantic-model.md ## Permission Scopes: Site Analytics - read permissions: SCOPE.DC-ANALYTICS-AND-REPORTS.READ-SITE-ANALYTICS ## Introduction Retrieves a semantic model by ID. --- ## REST API ### Schema ``` Method: getSemanticModel Description: Retrieves a semantic model by GUID. URL: https://www.wixapis.com/analytics/semantic-model/v3/semantic-models/{semanticModelId} Method: GET # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: semanticModelId Method parameters: param name: semanticModelId | type: none | required: true Return type: GetSemanticModelResponse - name: semanticModel | type: SemanticModel | description: Retrieved semantic model. - name: id | type: string | description: Semantic model GUID. | validation: format GUID - name: slug | type: string | description: URL-friendly identifier for the semantic model. | validation: maxLength 5120 - name: measures | type: array | description: Quantitative fields available for aggregation, such as revenue, page views, or order count. | validation: maxItems 1000 - name: name | type: string | description: Field name. Use this value in the `fields` array of a query request to retrieve this field's data. | validation: maxLength 5120 - name: type | type: FieldTypeEnum | description: Data type of the field. - enum: - UNKNOWN: Unknown field type. - STRING: String. - NUMBER: Number. - BOOLEAN: Boolean. - DATE: Date without time. - DATE_TIME: Date and time. - OBJECT: Structured object with key-value pairs. - ARRAY: Array of values. - name: filters | type: FieldFilters | description: Supported filter operations for this field. - name: prefixes | type: array | description: Supported prefix modifiers for this field. | validation: maxItems 100 - enum: - IS: Positive match. For example, `IS` + `EQUAL` means "is equal to". - NOT: Negated match. For example, `NOT` + `EQUAL` means "is not equal to". - name: conditions | type: array | description: Supported comparison conditions for this field. | validation: maxItems 100 - enum: - EQUAL: Value equals the filter value. - GREATER_THAN: Value is greater than the filter value. - GREATER_THAN_OR_EQUAL: Value is greater than or equal to the filter value. - LESS_THAN: Value is less than the filter value. - LESS_THAN_OR_EQUAL: Value is less than or equal to the filter value. - NULL: Value is null. - EMPTY: Value is an empty string. - START_WITH: String value starts with the filter value. - END_WITH: String value ends with the filter value. - CONTAINS_ANY: For strings, matches if any of the filter values appear as a substring. For arrays, matches if any of the filter values are present in the array. - RANGE_II: Inclusive start, inclusive end range. The value must fall within `[a, b]`. - RANGE_IE: Inclusive start, exclusive end range. The value must fall within `[a, b)`. - RANGE_EI: Exclusive start, inclusive end range. The value must fall within `(a, b]`. - RANGE_EE: Exclusive start, exclusive end range. The value must fall within `(a, b)`. - CONTAINS_ALL: For strings, matches if all filter values appear as substrings. For arrays, matches if all filter values are present in the array. - name: sortable | type: boolean | description: Whether this field supports sorting. - name: enumerations | type: array | description: Allowed values for this field, if the field is an enumerated type. | validation: maxItems 100, maxLength 5120 - name: groupSlug | type: string | description: Grouping identifier. Fields with the same `groupSlug` are logically related. | validation: maxLength 5120 - name: description | type: string | description: Human-readable description of what this field represents. | validation: maxLength 5120 - name: dependencies | type: array | description: Other fields this field depends on. The field returns data only if at least one of these fields is also included in the query; otherwise it's silently omitted from results. | validation: maxItems 100, maxLength 5120 - name: dimensions | type: array | description: Categorical fields available for grouping data, such as traffic source, country, or product name. | validation: maxItems 1000 - name: parameters | type: array | description: Optional inputs that customize query behavior, such as currency or date granularity. | validation: maxItems 1000 - name: description | type: string | description: Human-readable description of the semantic model. | validation: maxLength 5120 - name: keywords | type: array | description: Keywords associated with the semantic model for search and discovery. | validation: maxItems 100, maxLength 5120 Possible Errors: HTTP Code: 401 | Status Code: UNAUTHENTICATED | Application Code: NO_ACCOUNT_IDENTITY | Description: The caller isn't authenticated. Provide valid credentials and try again. HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: SEMANTIC_MODEL_NOT_FOUND | Description: Couldn't find the semantic model. ``` ### Examples ### Get a semantic model by ID. ```curl curl -X GET \ 'https://www.wixapis.com/analytics/semantic-model/v3/semantic-models/cad7fd34-2c8b-4dda-8296-3f9d47fb484d' \ -H 'Content-type: application/json' \ -H 'Authorization: ' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.analytics.SemanticModelsService.getSemanticModel(semanticModelId) Description: Retrieves a semantic model by GUID. # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: semanticModelId Method parameters: param name: semanticModelId | type: string | description: GUID of the semantic model to retrieve. | required: true | validation: maxLength 5120 Return type: PROMISE - name: _id | type: string | description: Semantic model GUID. | validation: format GUID - name: slug | type: string | description: URL-friendly identifier for the semantic model. | validation: maxLength 5120 - name: measures | type: array | description: Quantitative fields available for aggregation, such as revenue, page views, or order count. | validation: maxItems 1000 - name: name | type: string | description: Field name. Use this value in the `fields` array of a query request to retrieve this field's data. | validation: maxLength 5120 - name: type | type: FieldTypeEnum | description: Data type of the field. - enum: - UNKNOWN: Unknown field type. - STRING: String. - NUMBER: Number. - BOOLEAN: Boolean. - DATE: Date without time. - DATE_TIME: Date and time. - OBJECT: Structured object with key-value pairs. - ARRAY: Array of values. - name: filters | type: FieldFilters | description: Supported filter operations for this field. - name: prefixes | type: array | description: Supported prefix modifiers for this field. | validation: maxItems 100 - enum: - IS: Positive match. For example, `IS` + `EQUAL` means "is equal to". - NOT: Negated match. For example, `NOT` + `EQUAL` means "is not equal to". - name: conditions | type: array | description: Supported comparison conditions for this field. | validation: maxItems 100 - enum: - EQUAL: Value equals the filter value. - GREATER_THAN: Value is greater than the filter value. - GREATER_THAN_OR_EQUAL: Value is greater than or equal to the filter value. - LESS_THAN: Value is less than the filter value. - LESS_THAN_OR_EQUAL: Value is less than or equal to the filter value. - NULL: Value is null. - EMPTY: Value is an empty string. - START_WITH: String value starts with the filter value. - END_WITH: String value ends with the filter value. - CONTAINS_ANY: For strings, matches if any of the filter values appear as a substring. For arrays, matches if any of the filter values are present in the array. - RANGE_II: Inclusive start, inclusive end range. The value must fall within `[a, b]`. - RANGE_IE: Inclusive start, exclusive end range. The value must fall within `[a, b)`. - RANGE_EI: Exclusive start, inclusive end range. The value must fall within `(a, b]`. - RANGE_EE: Exclusive start, exclusive end range. The value must fall within `(a, b)`. - CONTAINS_ALL: For strings, matches if all filter values appear as substrings. For arrays, matches if all filter values are present in the array. - name: sortable | type: boolean | description: Whether this field supports sorting. - name: enumerations | type: array | description: Allowed values for this field, if the field is an enumerated type. | validation: maxItems 100, maxLength 5120 - name: groupSlug | type: string | description: Grouping identifier. Fields with the same `groupSlug` are logically related. | validation: maxLength 5120 - name: description | type: string | description: Human-readable description of what this field represents. | validation: maxLength 5120 - name: dependencies | type: array | description: Other fields this field depends on. The field returns data only if at least one of these fields is also included in the query; otherwise it's silently omitted from results. | validation: maxItems 100, maxLength 5120 - name: dimensions | type: array | description: Categorical fields available for grouping data, such as traffic source, country, or product name. | validation: maxItems 1000 - name: parameters | type: array | description: Optional inputs that customize query behavior, such as currency or date granularity. | validation: maxItems 1000 - name: description | type: string | description: Human-readable description of the semantic model. | validation: maxLength 5120 - name: keywords | type: array | description: Keywords associated with the semantic model for search and discovery. | validation: maxItems 100, maxLength 5120 Possible Errors: HTTP Code: 401 | Status Code: UNAUTHENTICATED | Application Code: NO_ACCOUNT_IDENTITY | Description: The caller isn't authenticated. Provide valid credentials and try again. HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: SEMANTIC_MODEL_NOT_FOUND | Description: Couldn't find the semantic model. ``` ### Examples ### Get a semantic model by ID. ```javascript import { analyticsSemanticModel } from "@wix/analytics-semantic-model"; async function getSemanticModel() { const response = await analyticsSemanticModel.getSemanticModel( "cad7fd34-2c8b-4dda-8296-3f9d47fb484d" ); } /* Promise resolves to: { "semanticModel": { "id": "cad7fd34-2c8b-4dda-8296-3f9d47fb484d", "slug": "traffic", "description": "Site traffic metrics including sessions, page views, and bounce rate.", "measures": [ { "name": "traffic.sessions_count", "type": "NUMBER", "sortable": true, "description": "The total number of site sessions. A session is a visit to a site that ends after 30 minutes of inactivity.", "filters": { "prefixes": [ "IS", "NOT" ], "conditions": [ "EQUAL", "GREATER_THAN", "LESS_THAN", "GREATER_THAN_OR_EQUAL", "LESS_THAN_OR_EQUAL", "RANGE_II", "RANGE_IE", "RANGE_EI", "RANGE_EE", "NULL" ] } }, { "name": "traffic.site_bounce_ratio", "type": "NUMBER", "sortable": true, "description": "Bounce rate: the percentage of visitors who leave a site after viewing only one page. A high bounce rate might indicate that visitors are not finding what they're looking for, the page isn't engaging enough, or there might be issues with the quality of traffic.", "filters": { "prefixes": [ "IS", "NOT" ], "conditions": [ "EQUAL", "GREATER_THAN", "LESS_THAN", "GREATER_THAN_OR_EQUAL", "LESS_THAN_OR_EQUAL", "RANGE_II", "RANGE_IE", "RANGE_EI", "RANGE_EE", "NULL" ] } }, { "name": "traffic.views_count", "type": "NUMBER", "sortable": true, "description": "Pages Viewed. The total number of times a page was viewed.", "filters": { "prefixes": [ "IS", "NOT" ], "conditions": [ "EQUAL", "GREATER_THAN", "LESS_THAN", "GREATER_THAN_OR_EQUAL", "LESS_THAN_OR_EQUAL", "RANGE_II", "RANGE_IE", "RANGE_EI", "RANGE_EE", "NULL" ] } } ], "dimensions": [ { "name": "traffic.country_code", "type": "STRING", "sortable": true, "description": "Country: the ISO 3166 Alpha-2 country code from which the visitor accessed the site. (e.g. CA, US). When users are asking about international users do not filter on this fields, only add it to fields.", "filters": { "prefixes": [ "IS", "NOT" ], "conditions": [ "EQUAL", "CONTAINS_ANY", "CONTAINS_ALL", "START_WITH", "END_WITH", "NULL", "EMPTY" ] } }, { "name": "traffic.created_timeframe", "type": "DATE_TIME", "sortable": true, "description": "Date: add date as a field only when the user asks to compare between different time periods or to look for a trend over time (questions might include words like most, least, top, popular, busy, lowest, highest). Don't filter by dates, this function is handled in a different prompt. \n", "filters": { "prefixes": [ "IS", "NOT" ], "conditions": [ "EQUAL", "GREATER_THAN", "LESS_THAN", "GREATER_THAN_OR_EQUAL", "LESS_THAN_OR_EQUAL", "RANGE_II", "RANGE_IE", "RANGE_EI", "RANGE_EE", "NULL" ] } }, { "name": "traffic.referrer_category_name", "type": "STRING", "sortable": true, "description": "Traffic Category: categories of sites that people navigate to a site from. They indicate the type of the site (for example, social, email, search) and whether the traffic was free or paid. Possible values: paid_search, paid_ads, social, organic_search, wix_email_marketing, email_marketing, email, direct, referral,wix_fb_ads, wix_google_ads. You cannot filter by other values e.g. Facebook, Instagram.", "filters": { "prefixes": [ "IS", "NOT" ], "conditions": [ "EQUAL", "CONTAINS_ANY", "CONTAINS_ALL", "START_WITH", "END_WITH", "NULL", "EMPTY" ] } } ], "parameters": [ { "name": "timeframeGranularity", "type": "STRING", "filters": { "prefixes": [ "IS" ], "conditions": [ "EQUAL" ] }, "sortable": true, "enumerations": [ "DAY", "WEEK", "MONTH", "YEAR" ], "groupSlug": "", "description": "Use this as a filter only when comparison_timeframe is included in the \"fields\" list. The only possible values are day, week, and month. \nIt's forbidden to filter timeframe_granularity by quarter or year.\nIf users ask to group by other values, suggest one of the available groupings (day, week, or month).\n\n\nExample: If a user asks, \"Provide me with unique visitors by quarter for 2023 and 2024,\" suggest looking at it by month.", "dependencies": [] } ] } } */ ``` ### getSemanticModel (self-hosted) Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md). ```javascript import { createClient } from '@wix/sdk'; import { analyticsSemanticModel } from '@wix/analytics-semantic-model'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { analyticsSemanticModel }, // Include the auth strategy and host as relevant }); async function getSemanticModel(semanticModelId) { const response = await myWixClient.analyticsSemanticModel.getSemanticModel(semanticModelId); }; ``` ---