From d6c2b212f36acfa6be31869f6aaf309799347c64 Mon Sep 17 00:00:00 2001 From: Zhun Han Date: Mon, 27 Jan 2025 20:00:55 +0000 Subject: [PATCH 1/5] zhunhan:add internalUsageAttributionId to examples and README. --- README.md | 11 +++++++++++ examples/index.html | 10 ++++++++++ 2 files changed, 21 insertions(+) diff --git a/README.md b/README.md index 6d1b27ff..763ed8a7 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,9 @@ npm i -D @types/google.maps The reference documentation can be found at this [link](https://googlemaps.github.io/js-api-loader/index.html). The Google Maps JavaScript API [documentation](https://developers.google.com/maps/documentation/javascript/tutorial) is the authoritative source for the loader options. +## Internal usage attribution ID + +This library uses `internalUsageAttributionIds`, which helps Google understand which libraries and samples are helpful to developers and is optional. Instructions for opting out of the identifier are provided in reference documentation. ## Example @@ -59,6 +62,14 @@ const mapOptions = { zoom: 4 }; +// Adds a usage attribution ID to the initializer, which helps Google understand which libraries and samples are helpful to developers, such as usage of this library. +// To opt out of sending the usage attribution ID, it is safe to set the const to false or replace the value with an empty string. +const useIneternalUsageAttributionId = true; +const internalUsageAttributionId = "GMP_LIB_JS_API_LOADER"; + +if (useIneternalUsageAttributionId) { + mapOptions.internalUsageAttributionIds = [internalUsageAttributionId]; +} ``` Using a promise for a specific library. diff --git a/examples/index.html b/examples/index.html index 522496c8..526614ac 100644 --- a/examples/index.html +++ b/examples/index.html @@ -50,6 +50,16 @@ zoom: 4, mapId: "DEMO_MAP_ID" }; + + // Adds a usage attribution ID to the initializer, which helps Google understand which libraries and samples are helpful to developers, such as usage of this library. + // To opt out of sending the usage attribution ID, it is safe to set the const to false or replace the value with an empty string. + + const useInternalUsageAttributionId = true; + const internalUsageAttributionId = "GMP_LIB_JS_API_LOADER"; + + if (useInternalUsageAttributionId) { + mapOptions.usageAttributionIds = [internalUsageAttributionId]; + } const loader = new google.maps.plugins.loader.Loader({ apiKey: "", From ddff6325851341a5e86124677545bb78c454ff69 Mon Sep 17 00:00:00 2001 From: Zhun Han Date: Thu, 6 Feb 2025 15:35:04 +0000 Subject: [PATCH 2/5] fix: update on InternalUsageAttributionIds --- README.md | 13 ------------- examples/index.html | 9 ++++----- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 763ed8a7..de93e867 100644 --- a/README.md +++ b/README.md @@ -39,10 +39,6 @@ npm i -D @types/google.maps The reference documentation can be found at this [link](https://googlemaps.github.io/js-api-loader/index.html). The Google Maps JavaScript API [documentation](https://developers.google.com/maps/documentation/javascript/tutorial) is the authoritative source for the loader options. -## Internal usage attribution ID - -This library uses `internalUsageAttributionIds`, which helps Google understand which libraries and samples are helpful to developers and is optional. Instructions for opting out of the identifier are provided in reference documentation. - ## Example ```javascript @@ -61,15 +57,6 @@ const mapOptions = { }, zoom: 4 }; - -// Adds a usage attribution ID to the initializer, which helps Google understand which libraries and samples are helpful to developers, such as usage of this library. -// To opt out of sending the usage attribution ID, it is safe to set the const to false or replace the value with an empty string. -const useIneternalUsageAttributionId = true; -const internalUsageAttributionId = "GMP_LIB_JS_API_LOADER"; - -if (useIneternalUsageAttributionId) { - mapOptions.internalUsageAttributionIds = [internalUsageAttributionId]; -} ``` Using a promise for a specific library. diff --git a/examples/index.html b/examples/index.html index 526614ac..819ee1d8 100644 --- a/examples/index.html +++ b/examples/index.html @@ -51,14 +51,13 @@ mapId: "DEMO_MAP_ID" }; - // Adds a usage attribution ID to the initializer, which helps Google understand which libraries and samples are helpful to developers, such as usage of this library. - // To opt out of sending the usage attribution ID, it is safe to set the const to false or replace the value with an empty string. - + // See https://developers.google.com/maps/documentation/javascript/reference/map#MapOptions.internalUsageAttributionIds + const useInternalUsageAttributionId = true; - const internalUsageAttributionId = "GMP_LIB_JS_API_LOADER"; + const internalUsageAttributionIds = ["GMP_LIB_JS_API_LOADER"]; if (useInternalUsageAttributionId) { - mapOptions.usageAttributionIds = [internalUsageAttributionId]; + mapOptions.usageAttributionIds = internalUsageAttributionIds; } const loader = new google.maps.plugins.loader.Loader({ From d037463719bcb553ca61193e5ebefbc54f2c3122 Mon Sep 17 00:00:00 2001 From: Zhun Han Date: Thu, 6 Feb 2025 15:37:57 +0000 Subject: [PATCH 3/5] fix: format. --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index de93e867..6d1b27ff 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,7 @@ npm i -D @types/google.maps The reference documentation can be found at this [link](https://googlemaps.github.io/js-api-loader/index.html). The Google Maps JavaScript API [documentation](https://developers.google.com/maps/documentation/javascript/tutorial) is the authoritative source for the loader options. + ## Example ```javascript @@ -57,6 +58,7 @@ const mapOptions = { }, zoom: 4 }; + ``` Using a promise for a specific library. From d2114baa49f18df4f20ec739210d6b137a0ba703 Mon Sep 17 00:00:00 2001 From: Zhun Han Date: Thu, 6 Feb 2025 15:40:03 +0000 Subject: [PATCH 4/5] fix: typo. --- examples/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/index.html b/examples/index.html index 819ee1d8..719eecdd 100644 --- a/examples/index.html +++ b/examples/index.html @@ -57,7 +57,7 @@ const internalUsageAttributionIds = ["GMP_LIB_JS_API_LOADER"]; if (useInternalUsageAttributionId) { - mapOptions.usageAttributionIds = internalUsageAttributionIds; + mapOptions.internalUsageAttributionIds = internalUsageAttributionIds; } const loader = new google.maps.plugins.loader.Loader({ From aa457a86a474d13b34dca94175ddc83ca01a0d90 Mon Sep 17 00:00:00 2001 From: Zhun Han Date: Tue, 11 Feb 2025 15:55:42 +0000 Subject: [PATCH 5/5] fix:update internalUsageAttributionId to use the suggested value. --- examples/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/index.html b/examples/index.html index 719eecdd..304796bf 100644 --- a/examples/index.html +++ b/examples/index.html @@ -54,7 +54,7 @@ // See https://developers.google.com/maps/documentation/javascript/reference/map#MapOptions.internalUsageAttributionIds const useInternalUsageAttributionId = true; - const internalUsageAttributionIds = ["GMP_LIB_JS_API_LOADER"]; + const internalUsageAttributionIds = ["gmp_googlemaps_jsapiloaderlibrary_v1_example"]; if (useInternalUsageAttributionId) { mapOptions.internalUsageAttributionIds = internalUsageAttributionIds;