It sounds pretty simple (or maybe it doesn’t sound simple at all), but it can get pretty complicated. We’ve been working on a client project in which we need to configure advanced form abandonment tracking (FAT) for not one but five (or is it six?) forms…some of which can appear on the same page and be interacted with one after the other without triggering an easy-to-hear “abandonment event”.
Anyhow, I think we have it close to finished now. I spun up a separate GTM container and tested new versions of all the tags we need. I just need to have Ruth and Will check it out and then import it into the client’s container.
Unfortunately, I had to do this thing I do where I essentially rewrite the entire code base rather than resolving the issues in my team’s code. It’s not because their code is bad; it’s because I don’t know what’s breaking it or otherwise causing it not to work and the only way I can solve the problem is by rewriting it from the ground up.
I was able to do some fun stuff this time, like putting reusable FAT functions (i.e., pushToDataLayer, prettifyFormInteractions) in a single, reusable GTM tag rather than duplicating that code in every form-specific tag. I felt pretty good about that. I also built a configuration array so that, ostensibly, someone could duplicate this tag and change the configuration settings all in one place and not have to touch any of the other code.
Case in point: I just learned what variable hoisting is.