Export All of Your Tags from GTM to a Spreadsheet Effortlessly

Are you looking to perform an audit or organize your Google Tag Manager (GTM) tags into a neat spreadsheet? You might have noticed GTM doesn’t offer a direct way to do this. But don’t worry, we’ve got a straightforward, no-coding-required solution for you!

Why Export GTM Tags to a Spreadsheet?

Whether it’s for auditing purposes or just to keep your digital marketing efforts organized, having your GTM tags in a spreadsheet can be incredibly helpful. It allows you to review and manage your tags efficiently, especially when you’re dealing with a large number of them.

Steps to Copy GTM Tags to a Spreadsheet

Our technique involves using a simple JavaScript snippet in your browser’s Dev Tools console. This script will extract all your GTM tags in a JSON format. From there, you can easily convert this JSON file into a CSV format using an online tool like this or a straightforward Python script (see example below).

This method is as simple as copy-pasting the code and following a few easy steps.

  1. Copy the script provided below
  2. Open GTM to the tags section (set to display all tags)
  3. Open Dev Tools (Ctr + Shift + C), go to Console, paste the script and click Enter
  4. Copy the resulting JSON object
  5. Go to this free JSON to CSV/Excel converter  and paste the JSON code
  6. Download the result in CSV or Excel format


Here is how the end result looks like:

The JavaScript Script to Use in Console of Chrome Dev Tools

Here’s the JavaScript script you’ll need to use:

					// Paste this script in the Console section of your browser Dev Tools.  
gtmData = [];

var button = document.querySelector(".suite.suite-up-button.md-button.md-standard-theme.md-ink-ripple.layout-align-start-center.layout-row");

// Extract the account name
var accountNameElements = button.querySelectorAll(".suite-up-button-text-secondary");
var accountName;
if (accountNameElements.length > 1) {
    accountName = accountNameElements[1].textContent.trim();
} else {
    console.log("Expected more than one .suite-up-button-text-secondary element, found less");

// Extract the GTM container name
var gtmContainerNameElement = button.querySelector(".suite-up-text-name");
var gtmContainerName = gtmContainerNameElement.textContent.trim();

// GTM Container ID
var gtmNumber = document.querySelector('.gtm-container-public-id.md-gtm-theme').textContent.trim();

document.querySelectorAll('tr[gtm-table-row]').forEach(n => {
    const td2 = n.querySelector('td:nth-child(2)');
    const td3 = n.querySelector('td:nth-child(3)');
    const td4 = n.querySelector('td:nth-child(4)');
    const td5 = n.querySelector('td:nth-child(5)');

    const triggerName = td2 ? td2.textContent.trim() : '';
    const eventType = td3 ? td3.textContent.trim() : '';
    const firingTriggers = Array.from(n.querySelectorAll('td:nth-child(4) .small-trigger-chip')).map(conditionElement => conditionElement.textContent.trim());
    const lastEdited = td5 ? td5.textContent.trim() : '';

    // To find if Tag is currently paused 
    let paused;
    if (td5) {
        const lastEditedClassNames = Array.from(td5.childNodes).filter(child => child.clientHeight > 0);
        paused = lastEditedClassNames.length !== 0;
    } else {
        console.log("No td:nth-child(6) found.");

    const tag = {
        Account: accountName,
        Property: gtmContainerName,
        GTM_Container: gtmNumber,  
        Name: triggerName,
        Type: eventType,
        Firing_Triggers: firingTriggers,
        Last_Edited: lastEdited,
        Currently_Paused: paused


console.log(gtmData); // To see the output in console


Just copy and paste this script into your browser’s console when you have your GTM container open to the Tags section. It will automatically gather all your tag details including:

  • Account name 
  • Container ID
  • Tag Name
  • Tag Type
  • Firing Triggers
  • Last edited 
  • Tag Paused (true/false) 

Copy the Tags (JSON Object)

Once you have your JSON, right click on it and copy:

Convert to CSV/Excel and Download

Then head over to this free online JSON to CSV converter for an easy conversion to CSV.

Here is how the end result will look like:


Alternatively, if you’re comfortable with a bit of Python, here’s a simple script that helps you convert your saved JSON file (you’ll have to copy that JSON and save it on your computer with .json extension):

					# Convert JSON object to CSV

import pandas as pd

# Create DataFrame from JSON file
df = pd.read_json('file.json') # path to your JSON file 

# Save DataFrame to CSV file
df.to_csv('file.csv', index=False) # target path and file name


And there you have it! A quick and hassle-free way to get your GTM tags organized into a spreadsheet. This method is perfect for digital marketers, SEO specialists, or anyone who needs to audit or organize their GTM tags without diving deep into coding.

Remember, efficient data organization is key to a streamlined digital strategy, and with this simple technique, you’re well on your way to achieving just that. Happy organizing!

3 Responses

  1. This was really useful!

    Small update to the code as the currently_paused didn’t work for me:

    // To find if Tag is currently paused
    let paused;
    if (td5) {
    const lastEditedClassNames = Array.from(td5.childNodes).filter(child => child.clientHeight > 0);
    paused = lastEditedClassNames.length !== 0;
    } else {
    console.log("No td:nth-child(6) found.");

    const paused = n.classList.contains('gtm-table-row--paused');

    Also, if you want to output this to your clipboard, you can add:

    function jsonToCSV(json) {
    const fields = Object.keys(json[0]);
    const csv = json.map(row => {
    return fields.map(fieldName => {
    // Check if the field value is an array and handle it accordingly
    if (Array.isArray(row[fieldName])) {
    return '"' + row[fieldName].join(';') + '"'; // Join array elements with semicolon and enclose in quotes
    } else {
    return JSON.stringify(row[fieldName], replacer); // Use replacer to handle other data types and escaping

    csv.unshift(fields.join(",")); // add header column
    return csv.join("\r\n");

    function replacer(key, value) {
    // Handle escaping of quotes in strings
    if (typeof value === 'string') {
    return value.replace(/"/g, '""');
    return value;

    // Assuming 'gtmData' is your JSON array
    const csvData = jsonToCSV(gtmData);

    // Use the console's copy function

  2. This is fantastic! Super helpful.

    My only suggestion would be to include trigger exceptions and folders. Last_edited currently doesn’t work if there are folders and I think that’s what breaks currently_paused too.

  3. That’s really interesting, but it requires :
    – to have access to GTM
    – to use the snippet within GTM interface
    Therefore it is not of much use :
    – for an audit, where you might not have access to GTM
    – if you want toe automatize and perform at bigger scale

    Considering the code is accessible (it needs to be for it to work) at adresses like “https://www.googletagmanager.com/gtm.js?id=GTM-XXXXXX”, isn’t it possible to do something similar from there ?

Leave a Reply

Your email address will not be published. Required fields are marked *

Other Posts

Time on Site or Visit Duration Custom Trigger in GTM

Imagine you need to segment your users by their visit duration and break them down into groups like 3, 5, 10 minute visits. Such segmentation can help you enhance your marketing tactics, target your most engaged and interested users with custom messages and ads, remarket to them on social media…

Scraping Meta Business Manager: Quick Extraction of Useful Data

Sometimes, you need to quickly copy details from the Meta Business Manager to share via email or chat, or to include in a report or presentation—be it a list of ad accounts, pages, pixels, custom conversions, and more. Unfortunately, some of these elements aren’t as straightforward to copy and share…

Looker Studio Custom Channel Groupings

Google’s default channel groupings are notorious for misattributing traffic. More often than not, they assign it to the wrong channels or relegate it to the “Unassigned” category. This issue becomes even more pronounced in larger projects that utilize custom source/medium tags (UTM tags) without standardized naming conventions. It’s particularly challenging…