Where To Find The GTM Tag's Creation Date?

Where To Find The GTM Tag's Creation Date?

There are times when you audit GTM container tags (e.g. conversion tracking tags), and you are trying to track back the version where the tag was first time published. If the container you are inspecting, has a long history of published versions (also lacking a description), this may be a tedious job to do. It is also easy to overlook while browsing through the history, for example, the tag you are looking for, was modified or renamed more than once.

Here is a faster approach you may take advantage of.

Step 1 - source tags data request

Open up browser Developer Tools > Network tab. Now, source the tags XHR request by navigating to the tags screen in the main interface of GTM. This is actualy GTM API in action and it returns the tags metadata, which eventually you see in the view of the interface. It has very much in common with the publicly available GTM API, although the tag’s creation time is exclusively available only in the GTM application.

alt text

Step 2 - inspect the response

Now, as you click on that network request, you can either scroll through the response and find the location (CMD + F / CTRL + F) with the tag’s statMetadata property, or you can copy that to the JSON editor (e.g. JSON Viewer) to enable more friendly view and find the createdTime property. You want to find this:

"statMetadata": {
    "createdTime": "1627949091069",
    "modifiedTime": "1627949091069",
    "entityVersion": "1627949091069"
},

Step 3 - convert timestamp to readable time format

Here you can translate the timestamp to human readable time - Timestamp converter

Helper script

Alternatively, you can do everything in the console tab. Here is a script for that:

var tags = {"default": {...}} // declare a variable with the copied data object from the tags request/response

// Option 1 - Print all tags names and created time
for (i of tags.default.tag) {
    var name = i.data.name;
    var createdAt = new Date(parseInt(i.statMetadata.createdTime)); // or modifiedTime
    console.log( name + "                            " + createdAt);
}

// Option 2 - Print the specific tag
function getTagTime(tags, tagName) {
    for (i of tags.default.tag) {
        var name = i.data.name;
        var createdAt = new Date(parseInt(i.statMetadata.createdTime)); // or modifiedTime
        if (name == tagName) return name + "                            " + createdAt;
    }
}
getTagTime(tags, "LinkedIn Insights Tag") // use function and provide a tag name
// LinkedIn Insights Tag                            Tue Aug 15 2017 09:43:29 GMT+0200 (Central European Summer Time)

Step 4 - map a version

Having found the time of the tag creation, you can now get closer to the exact version with that published tag. Obviously, any version published at the tag’s creation date or any next version from that date onwards, would probably be the one you are looking for.