• Resolved simjost

    (@simjost)


    Hi,

    it would be great, if we could set some settings, mostly the gtm id, via the wp-config.php
    Especially for systems for which continuous integration and different configuration for different environments is used, it would be a huge time saver.

    Thanks and greetings from Hannover, Germany,

    Joda

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Thomas Geiger

    (@duracelltomi)

    Hi Joda,

    This is already possible, you can use these PHP constants to fix some plugin options:

    GTM4WP_HARDCODED_GTM_ID
    GTM4WP_HARDCODED_GTM_ENV_AUTH
    GTM4WP_HARDCODED_GTM_ENV_PREVIEW

    Thread Starter simjost

    (@simjost)

    @duracelltomi that’s good to know!
    Is this documented somewhere? With additional information on how to use them properly?

    Plugin Author Thomas Geiger

    (@duracelltomi)

    Hi,

    It is not yet documented on the website but it was mentioned in the cnangelog.
    I will do my best to create a documentation page as well.

    Plugin Author Thomas Geiger

    (@duracelltomi)

    About the “how to use”: you should open your wp-config.php and add the appropriate lines here, like:

    define('GTM4WP_HARDCODED_GTM_ID', 'GTM-ABCDEF');

    If you define the 3 constants, GTM4WP use this instead of any input in plugin options. You should “just” make sure that while deploying your site from dev to live, do not deploy wp-config.php. But this is usually already part of the process.

    Thread Starter simjost

    (@simjost)

    @duracelltomi thanks for the response.
    The questions was, what the 2 later constants are used for. I checked the code and found out ??
    They are used to predefine the necessary variables to jump directly into a preview environment of GTM.

    Thanks!

    • This reply was modified 3 years, 1 month ago by simjost.
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[feature request] Set GTM ID via wp-config.php’ is closed to new replies.