Building a Chrome Extension for DTM

2 years ago I asked for a way to export all of my tags into a nice, neat .csv where I can browse my tag library without having to individually go from rule-to-rule. Well, I finally got fed up with waiting and now I’m building one. So far I’m able to spit out a list of all of the rules and their properties in a console.log. I’m also able to export the data into an extensionless “download” file. Right now it’s a very crude product and well in its infancy stage with the most difficult parts still ahead of me. Here’s an example of the DTM library – it’s the one my company is currently using. Everything is laid out pretty neatly.

The extension basically scans for some key terms by looking for some terms (one for Event rules, one for Page Load, another for Direct Call). It then assigns an index for each of those terms and grabs everything via a substring function. From there, the rules are parsed out with regular expressions (which is probably not the most sustainable method) and then formatted for a .csv file. I think I’m about 15% of the way through with the project – and that’s with only a few hours of focused work (I’m not the best coder).

Anyways, I’ll post updates as the project progresses.

10 thoughts on “Building a Chrome Extension for DTM”

  1. Awesome. That’s been a dream of mine too. How’s it going with the extension part of the work? When I was working on this I got stuck by the fact that while I could run stuff in the console to inspect the _satellite object, I could not access it from the protected confines of an extension. I thought that maybe rather than an extension, it could be done as a bookmarklet (like the adobe digital pulse debugger) since that would have access to the current window.

    Here’s one of the things I was hoping to get into mine. It looks at all the event rules and determines while ones are in scope based on the current state of the elements in the DOM.

    var rules=_satellite.configurationSettings.rules;
    for (var i=0; i 0){
      _satellite.notify(“RULE IN SCOPE : “+rules[i].name + “ SELECTOR : “+rules[i].selector,1);
      }
      }
    }

    Reply
    • Hey Stewart – You’re exactly right. You can’t grab it with an extension so it has to be a bookmarklet. I tried everything to make it work as an extension – like a tab in the inspector window, but the only way it will be possible would be to store the data in a DB, check the current URL, and pull the data from the DB. That’s no fun. We’re like 80% of the way there with the bookmarklet. I’m hoping we can have something released in the next month or two!

      Reply
    • I estimate we’re about 1 month out from its release. Keep an eye out. I haven’t posted much lately, but when it’s done you’ll know! Thanks for keeping track! Good to know there is still demand.

      Reply
    • Hey Ivan! I’m almost there. Give me a week or two and we’ll have a preview. Tell Jessica I said hi!

      Reply
        • Hey Sky – If I showed you a preview of it in its current state you would vomit and never return to my site! We’re about a month out from our alpha phase. If you haven’t done so already, please go here and sign up. We’ll let you know as soon as it’s ready.

          Reply

Leave a Comment