Loading...
Loading...
Compares current live GTM container against last known state from gtm-implementation-log.json. Shows what tags, triggers, and variables have been added, deleted, or modified since the last skill run. Read-only, no changes made. Prevents accidentally overwriting manual GTM changes. Trigger on - "what changed in GTM", "gtm diff", "check for manual changes", "gtm drift", "what's different in my container", "has anything changed".
npx skill4agent add aimonk2025/google-tag-manager-automation gtm-diffgtm-context.mdCheck for gtm-implementation-log.json in the project root.
If not found:
"No gtm-implementation-log.json found. This file is created by gtm-implementation.
Without it, there is no baseline to diff against.
Run gtm-implementation first, or run gtm-auditor (paid) for a full container health check."
Stop.
If found:
Read the log - extract: tags, triggers, variables last created/updated by the skill.
Note the timestamp of the last implementation run.Check for gtm-config.json and gtm-token.json.
If missing:
"GTM API credentials not found. Run gtm-setup first to configure API access."
Stop.
If found: proceed.// List all workspaces
const workspacesResponse = await tagmanager.accounts.containers.workspaces.list({
parent: `accounts/${accountId}/containers/${containerId}`
})
const workspaces = workspacesResponse.data.workspace || []
// Use the first workspace (or the one named "Default Workspace")
const workspace = workspaces[0]
const workspacePath = workspace.path// Fetch all tags in the current workspace
const tagsResponse = await tagmanager.accounts.containers.workspaces.tags.list({
parent: workspacePath
})
// Fetch all triggers
const triggersResponse = await tagmanager.accounts.containers.workspaces.triggers.list({
parent: workspacePath
})
// Fetch all variables
const variablesResponse = await tagmanager.accounts.containers.workspaces.variables.list({
parent: workspacePath
})Fetching current container state...
✓ Tags: X found
✓ Triggers: X found
✓ Variables: X found=== GTM Container Diff ===
Container: [containerId]
Baseline: gtm-implementation-log.json (last run: [timestamp])
Current state: fetched [current timestamp]
--- Tags ---
+ [Tag Name] (Custom HTML) - ADDED after last skill run
Possibly added manually in GTM UI
~ [Tag Name] (GA4 Event) - MODIFIED
Changed: Trigger assignment changed from "All Pages" to "DOM Ready"
Note: Manual change detected - verify before next implementation run
- [Tag Name] (GA4 Event) - DELETED
Was in implementation log but not in current container
No changes detected in tags. ✓
--- Triggers ---
[Same format]
--- Variables ---
[Same format]
--- Summary ---
Total changes since last implementation: X
Added: X (safe to keep - these are additions)
Deleted: X (may be intentional or accidental - verify)
Modified: X (review carefully before next implementation run)=== GTM Container Diff ===
No changes detected.
The current container matches gtm-implementation-log.json exactly.
Safe to proceed with a new implementation run.--- Recommendation ---
[No changes] → "Container matches implementation log. Safe to run gtm-implementation for your next changes."
[Only additions] → "X items were added manually. gtm-implementation will not overwrite these. Safe to proceed, but note the manual additions."
[Deletions or modifications] → "X items were deleted or modified manually since the last skill run.
Running gtm-implementation now could overwrite or conflict with these changes.
Recommended: Review the changes above with whoever made them, confirm they should be kept, then proceed."
[Many changes] → "Significant drift detected (X changes). Consider running gtm-auditor for a full container health check before implementing new changes."