diff --git a/docs/Usage-Guide.md b/docs/Usage-Guide.md index 4fa24d0..5f7d58f 100644 --- a/docs/Usage-Guide.md +++ b/docs/Usage-Guide.md @@ -11,14 +11,16 @@ For backwards compatibility all snippet types are allowed by default and user do If you need to customize this you should configure the following section: ``` json -"xbyk.tagmanager.modules": [ - "Kentico.VWO", - "Kentico.GoogleTagManager", - "Kentico.GoogleAnalytics4", - "Kentico.MicrosoftClarity", - "Kentico.Intercom", - "Kentico.CustomTag" -] +"CMSTagManager": { + "modules": [ + "Kentico.VWO", + "Kentico.GoogleTagManager", + "Kentico.GoogleAnalytics4", + "Kentico.MicrosoftClarity", + "Kentico.Intercom", + "Kentico.Custom" + ] +} ``` If any module is specified only the specified modules are included. If no module is specified or the section is not present all modules are included. diff --git a/examples/DancingGoat/appsettings.json b/examples/DancingGoat/appsettings.json index 2366ce1..3e84030 100644 --- a/examples/DancingGoat/appsettings.json +++ b/examples/DancingGoat/appsettings.json @@ -16,13 +16,15 @@ "ConnectionStrings": { "CMSConnectionString": "" }, - "xbyk.tagmanager.modules": [ - "Kentico.VWO", - "Kentico.GoogleTagManager", - "Kentico.GoogleAnalytics4", - "Kentico.MicrosoftClarity", - "Kentico.Intercom", - "Kentico.Custom", - "Custom.DancingGoatSnippet" - ] + "CMSTagManager": { + "modules": [ + "Kentico.VWO", + "Kentico.GoogleTagManager", + "Kentico.GoogleAnalytics4", + "Kentico.MicrosoftClarity", + "Kentico.Intercom", + "Kentico.Custom", + "Custom.DancingGoatSnippet" + ] + } } \ No newline at end of file diff --git a/src/Kentico.Xperience.TagManager/Snippets/SnippetFactoryStore.cs b/src/Kentico.Xperience.TagManager/Snippets/SnippetFactoryStore.cs index 8aad827..1e776a0 100644 --- a/src/Kentico.Xperience.TagManager/Snippets/SnippetFactoryStore.cs +++ b/src/Kentico.Xperience.TagManager/Snippets/SnippetFactoryStore.cs @@ -7,9 +7,9 @@ internal static class SnippetFactoryStore private static readonly Dictionary snippetFactories = []; public static void AddSnippetFactory(IConfiguration configuration) where TSnippetFactory : ISnippetFactory, new() { - const string section = "xbyk.tagmanager.modules"; + const string section = "CMSTagManager"; - var usedTagModuleSection = configuration.GetSection(section).GetChildren(); + var usedTagModuleSection = configuration.GetSection(section).GetSection("modules").GetChildren(); var snippetFactory = new TSnippetFactory(); var settings = snippetFactory.CreateCodeSnippetSettings(); string configurationString = settings.TagAppSettingsName;