
"As I understand, we have GTM credentials and connects website using the default scripts. When I try to connect the API and GTM, how to put credentials into WordPress to show weather conditions? <script> ! function(e, t, a, n) { e[n] = e[n] || [], e[n].push({ "gtm.start": (new Date).getTime(), event: "gtm.js" }), n = t.getElementsByTagName(a)[0], (a = t.createElement(a)).async = !0, a.src = "https://www.googletagmanager.com/gtm.js?id=GTM-XYZ", n.parentNode.insertBefore(a, n) }(window, document, "script", "dataLayer"); </script>"
"and PHP within WordPress: $lat = ''; $lon = ''; $apiKey = 'XYZ'; Should we read IP and set it up lat, lon, APIKey within GTM, or should it be WordPress managed? As I understand, APIKey is exposed to the public if this is managed within GTM."
GTM default scripts are installed and the goal is to connect a weather API to show conditions. Latitude and longitude values and an API key are being considered for placement either inside GTM or in WordPress PHP. The PHP snippet shows placeholders for $lat, $lon, and $apiKey. There is consideration of deriving location from the client IP. There is concern that placing the API key inside GTM will publicly expose it in client-side code. Server-side management avoids exposing the API key and allows the server to proxy requests for the weather data.
Read at SitePoint Forums | Web Development & Design Community
Unable to calculate read time
Collection
[
|
...
]