Currently I'm able to create Analytics rules which trigger based on URL, and then push the appropriate data onto the Adobe data layer. I was going to have these rules fire as 1st priority, and then I could use that Data layer information for analytics tracking using subsequent rules.
Is this bad practice? I've been unable to create working data elements for the data that gets pushed this way, but I'm still unsure if thats just user error, or because of something inherently wrong with the way I'm setting the data layer. The data is visible in the browser console, I just can't seem to get any Launch rules to meet a value comparison for data added this way.
I am trying to avoid having the AEM Sites developers put the Data layer into the source code directly. Any help is greatly appreciated.
I won't call it "bad" practice, but it is frowned upon, because it hinders discoverability.
There is a general understanding that the data layer is set from web page code (or scripts in the web page). Then the tag management system, e.g. Launch, simply acts as the consumer of the data layer.
If you do set the data layer within Launch, I suggest that you mark this clearly, e.g. in the Rule's notes or in the Action's name. This is so that future maintainers know what is happening there.
Also, to help with you with your troubleshooting effort, use the Adobe Experience Cloud Debugger extension for your browser. In its "Events" panel, you can see how the data layer gets set over time. It could be that the data layer value that you're comparing is unavailable at the moment when your Rule runs.