mirror of
https://github.com/google/nomulus.git
synced 2025-05-12 22:38:16 +02:00
Add Google Analytics to registrar console
To support the open source community, which may want to use different analytics services, we implement a soy template for analytics services that: 1) Does not require users to implement Google Analytics 2) Allows users to add their own analytics code to `Analytics.soy` 3) Gives users the flexibility to pass as much or as little static configuration to their custom analytics code as needed. 4) Ensures that users can merge upstream Nomulus code in the future without having to delete their custom analytics implementations 5) Does not allow code to be injected from configuration, which Soy as a framework actively discourages. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=248340081
This commit is contained in:
parent
7f69ebc5d9
commit
b12a462f5e
15 changed files with 135 additions and 3 deletions
|
@ -35,6 +35,9 @@ import java.lang.annotation.Documented;
|
|||
import java.lang.annotation.Retention;
|
||||
import java.net.URI;
|
||||
import java.net.URL;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.annotation.Nullable;
|
||||
|
@ -198,6 +201,22 @@ public final class RegistryConfig {
|
|||
return config.registrarConsole.technicalDocsUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Configuration for analytics services installed in the web console.
|
||||
*
|
||||
* @see google.registry.ui.server.registrar.ConsoleUiAction
|
||||
* @see google.registry.ui.soy.AnalyticsSoyInfo
|
||||
*/
|
||||
@Provides
|
||||
@Config("analyticsConfig")
|
||||
public static Map<String, Object> provideAnalyticsConfig(RegistryConfigSettings config) {
|
||||
// Can't be an ImmutableMap because it may contain null values.
|
||||
HashMap<String, Object> analyticsConfig = new HashMap<>();
|
||||
analyticsConfig.put(
|
||||
"googleAnalyticsId", config.registrarConsole.analyticsConfig.googleAnalyticsId);
|
||||
return Collections.unmodifiableMap(analyticsConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Google Cloud Storage bucket for storing zone files.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue