Closed phildpearce closed 10 years ago
Account switching is already handled gracefully by the existing config options. A different GTM container can be set at Magento's store view level, meaning that if you run multiple stores from one Magento installation, you can set a specific GTM container for each one as required.
Regarding the environmentIdentifier, this could more easily be handled using a host name macro in GTM and basing your DEV/STAGING/LIVE logic off that instead, perhaps with a lookup table for defining other environment-specific constants.
THANKS for the reminder about the gracefully existing config options for DEV and LIVE GMT-xxx I had forgotten about this!
Just need an export from DEV and import to LIVE gtm button to be launched soon ;)
Hostname whiteliste/blacklist rules are great but they require maintenance. environmentIdentifier is easier to maintenan. But the need for environmentIdentifier becomes redundant using the above option for separate GTM-xxx accounts. So thats great!
Add GTM-live and GTM-dev serverside switch and 2fields within Magento setting.
This means that export from DEV container to LIVE is simple, and there is not need to use hostname blocking rules.
<?php switch ($_SERVER['HTTP_HOST']) { case 'localhost': case 'dev.clientdomain.com': case 'staging.clientdomain.com': $gtm_account_id = 'GTM-DEV'; // Dev GTM break;
case 'www.clientdomain.com': $gtm_account_id = 'GTM-LIVE'; // LIVE GTM break; default: $gtm_account_id = 'GTM-LIVE'; // default to LIVE } ?>
Also adding "environmentIndentifer":"dev|staging|live"; would be good.