For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Dev Portal
DocsAPI ReferenceLearnCommunityChangelog
DocsAPI ReferenceLearnCommunityChangelog
  • Overview
    • Quick Start
    • Sandboxes
    • Tools & SDKs
    • Support
  • Docs
      • Getting Started
          • Store configuration
          • Locales configuration
          • Store logs
          • Data layer
    • Archive
    • Closed Beta Programs
Dev Portal
LogoLogo
On this page
  • Prerequisites
  • Get data layer
  • Enable data layer
  • Disable data layer
  • Resources
DocsAdminStore ConfigurationSettings

Data Layer Settings in the GraphQL Admin API

Was this page helpful?
Previous

Store logs

Next

Currencies Overview

Built with

The GraphQL Admin API’s data layer setting allows BigCommerce to send data from BigCommerce-hosted storefronts to third-party analytics providers through Big Open Data Layer. BigCommerce can build native integrations to analytics providers, such as Google Analytics 4, using the data layer. Partners may also build their own integrations using the data layer. In each case, you must first enable the data layer using the GraphQL Admin API. The data layer is enabled at the global level.

This guide shows you how to use the GraphQL Admin API’s data layer queries and mutations. For full schema, see the GraphQL Admin API reference.

Prerequisites

You need a store-level API account that contains the following OAuth scopes:

UI NamePermissionParameterDescription
Information & Settingsmodifystore_v2_informationView and modify store information and settings

For more about API accounts that generate access_tokens, see API Accounts and OAuth Scopes.

Get data layer

Send the following query to retrieve whether the data layer is enabled in the store:

Request
Response
Example query: Get data layer enabled flag
1POST https://api.bigcommerce.com/stores/{{STORE_HASH}}/graphql
2X-Auth-Token: {{ACCESS_TOKEN}}
3Content-Type: application/json
4Accept: application/json
5
6query {
7 store {
8 settings {
9 dataSolutions {
10 isDataLayerEnabled
11 }
12 }
13 }
14}

Enable data layer

Send the following mutation to enable the data layer in the store:

Request
Response
Example mutation: Enable data layer
1POST https://api.bigcommerce.com/stores/{{STORE_HASH}}/graphql
2X-Auth-Token: {{ACCESS_TOKEN}}
3Content-Type: application/json
4Accept: application/json
5
6mutation {
7 settings {
8 dataSolutions {
9 updateDataLayer (input: {isDataLayerEnabled: true}) {
10 dataSolutions {
11 isDataLayerEnabled
12 }
13 }
14 }
15 }
16}

Disable data layer

Send the following mutation to disable the data layer in the store:

Request
Response
Example mutation: Disable data layer
1POST https://api.bigcommerce.com/stores/{{STORE_HASH}}/graphql
2X-Auth-Token: {{ACCESS_TOKEN}}
3Content-Type: application/json
4Accept: application/json
5
6mutation {
7 settings {
8 dataSolutions {
9 updateDataLayer (input: {isDataLayerEnabled: false}) {
10 dataSolutions {
11 isDataLayerEnabled
12 }
13 }
14 }
15 }
16}

Resources

  • GraphQL Admin API reference
  • Big Open Data Layer