apostrophecms / apostrophe-seo

SEO for ApostropheCMS
MIT License
14 stars 8 forks source link

Environment specific Google Analytics IDs and/or Google Tag Manager IDs #50

Open shaunhurley opened 3 years ago

shaunhurley commented 3 years ago

The problem to solve

We like to test Google Tag Manager configurations in our dev/test environments (in conjunction with a GTM test container and test GA Property) prior to implementing in our production site.

Currently enabling Google Fields via the seoGoogleFields: true directive enables the fields becoming available in the Global menu option, meaning that they are stored in the database. Any synching of the database between environments will overwrite alternate configs in the target environment, risking polluting production analytics with development data (when the production IDs get used in a dev setting), and require a manual intervention to update with the correct IDs.

Proposed solution

Providing overrides in the local.js, a la baseURL and similar settings, to configure the appropriate Google IDs rather then using manually configured settings via the Admin menu tab.

Alternatives

Manual maintenance of environments.

abea commented 3 years ago

That sounds like a good idea. We'd appreciate a PR to add this.