humanmade / altis-analytics

Analytics module for Altis
https://www.altis-dxp.com/resources/docs/analytics/
GNU General Public License v3.0
9 stars 3 forks source link

Provide fallback for analytics.google-tag-manager config #357

Open kadamwhite opened 1 year ago

kadamwhite commented 1 year ago

This was observed on Altis 8/9, but may be useful on more modern versions: there was no handling for cases where analytics was set, but the google-tag-manager key was not, meaning that a warning would be shown when running CLI commands:

Notice: Undefined index: google-tag-manager in /usr/src/app/vendor/altis/privacy/inc/gtm/namespace.php on line 16

[] may not be the best fallback value, but I wanted to capture the thought while it was fresh. Unless I misunderstand how the configuration is accessed, I believe this could easily result in an undefined index warning as-is.

kadamwhite commented 1 year ago

This may not be necessary with the newer way configs get initialized, reading through more of the code. Won't have the bandwidth to do a version cross-comparison, unfortunately.