> This article is for developers who want to move their Cloud Retail tag off of
> the client and into a server container. Refer to the Google Cloud
> documentation for the [Cloud Retail web container tag](https://cloud.google.com/retail/docs/record-events#gtm-tag).

## Before you begin

This guide assumes that you have done the following:

- [Set up a server container in Tag Manager](https://developers.google.com/tag-platform/tag-manager/server-side/overview#create_a_tag_manager_server_container)
- [Set up a tagging server](https://developers.google.com/tag-platform/tag-manager/server-side/overview#set_up_a_tagging_server)
- [Set up the data flow from the web container to the server container](https://developers.google.com/tag-platform/tag-manager/server-side/send-data)

## Set up the Cloud Retail tag

1. [Open Google Tag Manager](https://tagmanager.google.com/)

2. In your server container, open the **Tags** menu and create a **New** tag.

3. In **Tag Configuration** , select the **Cloud Retail** tag.

4. Set up the Cloud Retail tag:

   - Under **API Key** , enter a valid Cloud Retail API key that supports the [`projects.locations.catalogs.userEvents.collect` method](https://cloud.google.com/retail/docs/reference/rest/v2/projects.locations.catalogs.userEvents/collect).
   - Under **Project Number**, enter the Google Cloud Project number for your Cloud Retail project.
   - Under **Fields to Overwrite** , set up a visitor ID:
     - **Field Selector** : `visitorId`
     - **Field Value**: Enter a variable that resolves into a unique visitor ID from a GA4 event, for example, the client ID.
   - Optional: To measure search events:
     - **Field Selector** : `searchQuery`
     - **Field Value** : Enter a variable that extracts the search query. The search event is constructed by combining the search event query with the impressions for the query, which are sent in `view_item_list`.
5. In **Triggering** , select when the tag should trigger. Refer to the Google
   Cloud documentation for [mappings between Google Analytics trigger events
   and Cloud Retail events](https://cloud.google.com/retail/docs/record-events#ee-triggers).

6. Name and **Save** your tag.