Search code examples
adobe-analytics

Adobe Dynamic Tag Management - handling form validation


I'm currently migrating Adobe Analytics s_code from a website to Dynamic Tag Management.

I have some custom code on my site to add to an sProp when a button is clicked. But only if the form validates first.

How do I achieve similar functionality via DTM? I have the Adobe Analytics tool working on it. I've created Data Elements and Rules for other functionality, but handling validation seems not so straight-forward.

Ideally, it wouldn't involve adding any code to my site, as the whole purpose of migrating to DTM was to reduce/eliminate the custom Adobe Analytics code on the site.


Solution

  • Bottom line is that there's always going to be a certain level of custom coding outside of DTM (or any tag manager) for gated stuff, because of arbitrary logic/code (server-side and/or client-side) which may or may not be setup in a way that can be passively hooked into. Some site content management systems/frameworks/libraries have this sort of thing in mind and make it (relatively) easy to register things during a given event. Others..not so much. Especially custom coded sites built from the ground up.

    The best thing to do would be to have a dedicated "thank you" page that can only be reached after the form has been successfully submitted. Then you can setup a page load rule in DTM based on the url of the page.

    Failing that, DTM doesn't really have a way to know that the form has been validated, unless you tell it. Basically what you want to do is setup a Direct Call Rule with a condition string of e.g. "formsubmitted" and then pop your AA code there, and then within your form validation logic, call _satellite.track('formsubmitted'); at a point in your code where the form has been validated. This will invoke the direct call rule.