If the production environment is in relation to the live site and has the default GTM container code installed on it, it doesnt need to be specified within GTM.
Every container is set up with a "Live" environment by default, which
always points to the container version that is currently published.
You don't need to define the Live environment.
Other environments will each have their own specific container code, installed to the applicable environment eg the container code for the staging environment will be installed on the staging site website.
Install your container snippets. This process is similar to installing
a standard Tag Manager container snippet, except that you have to do
this on every server that has a corresponding environment defined in
Tag Manager. This step may require assistance from a developer or
systems administrator to complete.
- In the Custom Environments listing, find the entry for the environment you would like to install.
- Click the Actions menu for that entry.
- Select Get Snippet.
- Copy the resulting code snippet and install it so that it will appear in the code of the target environment.
- Save and publish the website's code changes.
When you have custom environments
defined, the Publish dialog will add a menu so that you can define to
which server the changes will be published.
- Click Publish in the upper right corner of Tag Manager.
- Choose a selection from the Environment menu for where you want to publish your
changes.
- Click Publish.
More info on using Environments can be found in the GTM Help Center
https://support.google.com/tagmanager/answer/6311518?hl=en
There are so many ways to go about setting this up.
It really depends on your preferences and situation.
You can send hits to different GA Properties based on the Environment name, or you can send hits to different GA Properties based on a Hostname, you can also send hits to different GA Properties based on Hostname & Debug Mode (and the list goes on).
To send hits to different GA Properties based on the Hostname
1. Ensure the inbuilt variable for Page Hostname is turned "on" (it should be by default).
2. Create a Lookup Table variable, name it along the lines of Lookup - GA Tracking IDs.
3. For Input Variable, use {{Page Hostname}}.
4. In the first table row, for Input enter the hostname for your live site, and for Output, enter the live site's GA Tracking ID.
5. In the second table row, for Input enter the hostname for your staging site, and for the Output, enter the staging site's GA Tracking ID.
6. Plug {{Lookup - GA Tracking IDs}} variable into Tracking ID option of the GA Settings Variable.
To send hits to different GA Properties based on Environment
1. Turn "on" the builtin variable for Environment Name.
2. Create a Lookup Table variable, name it along the lines of Lookup - GA Tracking IDs.
3. For Input Variable, use {{Environment Name}}.
4. For Input value, enter the Environment Name, for Output value, enter the GA Tracking ID for the site that has the relevant Environment's container snippet installed.
5. Set the Default Value to the GA Tracking ID for the Property for the live website.
6. Plug {{Lookup - GA Tracking IDs}} variable into Tracking ID option of the GA Settings Variable.