#GTMTips: Quickly Duplicate Tags in Google Tag Manager

How to quickly duplicate tags, triggers, and variables in Google Tag Manager. This is useful for parallel tracking scenarios.

There are many reasons why you might want to duplicate your tags (or triggers, or variables, or templates) in Google Tag Manager.

One prime example is server-side tagging, where it’s sensible to first build and validate your tracking setup before migrating fully to a server-side approach.

Alternatively, you might want to collect analytics data to a second property, for example when you want to have a local and a global dataset for site visit data.

Google Tag Manager has an excellent feature that makes duplication of resources super easy: container export or, more specifically, partial container export.

Follow the steps in this guide to get it done!

Tip 139: Resource duplication in Google Tag Manager

Let’s use the example of server-side tagging here. I have a Google Analytics 4 tracking setup, and I want to migrate it to run through my server-side Google Tag Manager container.

Before I do that, I want to duplicate the existing setup, so that I can compare the server-side and client-side streams to make sure that the data collection is pristine. I don’t want to be blindsided by any data collection gaps once I make the migration to server-side tagging!

Here are the tags that I have:

To duplicate the tags, go to Admin and then choose Export Container in the container options.

Next, choose the version or workspace that has the items you want to export.

Finally, select / unselect until you’ve chosen all the tags that you want to duplicate.

Important! You do not have to select triggers or variables. The duplicated tags will contain the original references to the triggers and variables associated with them. You’ll see a warning about missing references but this can be ignored.

Once you’ve finished selecting, click the blue Export button in the top corner.

Now, to perform the actual duplication, in the Admin section, choose Import Container.

First, choose the container file you just exported, and then click to choose either a new or an existing workspace to import the duplicates.

Here comes the important step: Choose Merge and then Rename conflicting tags, triggers, and variables.

This selection means that the items in the import are added as copies of the originals. They’ll also be renamed automatically with the suffix _import_N to make sure the duplication conflict is resolved.

Once you’ve verified it looks good, click Add to workspace.

You can then go to the workspace and verify that everything was imported over.

Now you’ll just need to click through the copied items and make the necessary changes. Remember that if you’re doing this with Google Analytics 4, you must have a different Measurement ID for the duplicate tags.

In the example below, I’ve updated all the duplicate tags to collect to the measurement ID G-SERVERSIDE using the server_container_url field to redirect them to SGTM. In server-side Google Tag Manager, I’ll then map G-SERVERSIDE to the correct GA4 measurement ID for the parallel tracking property.

This method of using container export/import can be an extremely fast way to duplicate a large number of resources in the container. The amount of overhead after the duplication can be greatly reduced by using variables for fields that you’ll need to change, for example the Measurement ID and the event and configuration settings.

What do you think about this tip? Let me know in the comments if you have questions about this approach or suggestions for improvement!