Configuring the Transaction server
To complete the integration between a Store and Google Tag Manager, you must add the required parameters to the Transaction server.
Obtaining the Google Tag Manager container parameters
- Go to Google Tag Manager.
- Select the container and go to Admin tab > Environments.
- Click Actions > Get Snippet for live option.
- Copy the gtm_auth and gtm_preview values.
Important: Run the
curl commands
for each of the sections as the primary choice over running the INSERT
SQL statements.GA4 Configurations
Sample curl commands to add new configurations for the Transaction
server.
curl -k -u `spiuser:plain_text_spiuserPassword` --location 'https://<transaction_server_ip>:<port>/rest/admin/v2/store-configurations?storeId=<STOREENT_ID>' --header 'Content-Type: application/json' --data '{"storeId":<STOREENT_ID>,"name": "google.analytics.versions","value": "GA4"}'
curl -k -u `spiuser:plain_text_spiuserPassword` --location 'https://<transaction_server_ip>:<port>/rest/admin/v2/store-configurations?storeId=<STOREENT_ID>' --header 'Content-Type: application/json' --data '{"storeId":<STOREENT_ID>,"name": "google.tag.manager.container.id","value": "<YOUR STORE CONTAINER ID FROM THE GOOGLE TAG MANAGER CONFIGURATION>"}'
curl -k -u `spiuser:plain_text_spiuserPassword` --location 'https://<transaction_server_ip>:<port>/rest/admin/v2/store-configurations?storeId=<STOREENT_ID>' --header 'Content-Type: application/json' --data '{"storeId":<STOREENT_ID>,"name": "google.tag.manager.auth","value": "<YOUR STORE AUTH VALUE FROM THE GOOGLE TAG MANAGER CONFIGURATION>"}'
curl -k -u `spiuser:plain_text_spiuserPassword` --location 'https://<transaction_server_ip>:<port>/rest/admin/v2/store-configurations?storeId=<STOREENT_ID>' --header 'Content-Type: application/json' --data '{"storeId":<STOREENT_ID>,"name": "google.tag.manager.preview","value": "<YOUR STORE PREVIEW VALUE FROM THE GOOGLE TAG MANAGER CONFIGURATION>"}'
curl -k -u `spiuser:plain_text_spiuserPassword` --location 'https://<transaction_server_ip>:<port>/rest/admin/v2/store-configurations?storeId=<STOREENT_ID>' --header 'Content-Type: application/json' --data '{"storeId":<STOREENT_ID>,"name": "google.analytics.property.ga4,"value": "<YOUR GA4 PROPERTY ID FROM THE GOOGLE ANALYTICS ACCOUNT>"}'Sample SQL statements to configure the Transaction
server
INSERT INTO STORECONF (STOREENT_ID, NAME, VALUE, OPTCOUNTER) VALUES (<StoreId>, 'google.analytics.versions', 'GA4', 0);
INSERT INTO STORECONF (STOREENT_ID, NAME, VALUE, OPTCOUNTER) VALUES (<StoreId>, 'google.tag.manager.container.id', '<GTM_Container_ID>', 0);
INSERT INTO STORECONF (STOREENT_ID, NAME, VALUE, OPTCOUNTER) VALUES (<StoreId>, 'google.tag.manager.auth', '<GTM_AUTH_ID>', 0);
INSERT INTO STORECONF (STOREENT_ID, NAME, VALUE, OPTCOUNTER) VALUES (<StoreId>, 'google.tag.manager.preview', 'env-1', 0);
INSERT INTO STORECONF (STOREENT_ID, NAME, VALUE, OPTCOUNTER) VALUES (<StoreId>, 'google.analytics.property.ga4', 'GA4_Property_ID', 0);
Database configuration for the Next.s store to connect to the Analytics
| Table in Database | STOREENT_ID | Parameter name | Value |
|---|---|---|---|
| STORECONF | Enter your STOREENT_ID | google.tag.manager.container.id | Your store Container ID from the Google Tag Manager configuration. |
| STORECONF | Enter your STOREENT_ID | google.tag.manager.auth | Your store Auth value from the Google Tag Manager configuration. |
| STORECONF | Enter your STOREENT_ID | google.tag.manager.preview | Your store preview value from the Google Tag Manager configuration. |
| STORECONF | Enter your STOREENT_ID | google.analytics.versions | Google Analytics version. This can be UA or GA4 as per the GA setup. |
| STORECONF | Enter your STOREENT_ID | google.analytics.property.ga4 | Your property ID for the GA4 account. This is required in case of GA4 version. |
| STORECONF | Enter your STOREENT_ID | google.analytics.service.account.view.id | Service Account View Id. This is required in case of UA version. |
Note: Site Administrator can call the REST APIs to
update the settings instead of updating the STORECONREF
table as shown in the document.