nystudio107 / craft-instantanalytics-ga4

Instant Analytics brings full Google GA4 server-side analytics support to your Twig templates and automatic Craft Commerce integration
Other
3 stars 4 forks source link

Multi-site measurement IDs #15

Closed mikeymeister closed 1 year ago

mikeymeister commented 1 year ago

Question

Is it possible to define different api keys and secrets for different sites in a multisite setup? The site we are working on currently has seomatic but wants to switch to instant analytics for certain things. The Craft install has 3 sites and each one has a different measurement ID. The tracking scripts settings in Seomatic can be modified per site, but I can't see how to acheive this with instant analytics. Is it possible?

Thanks

khalwat commented 1 year ago

Not currently, no.

jripmeester commented 1 year ago

+1 Our client needs this enhancement too.

khalwat commented 1 year ago

You can change this via the Twig API if you like:

{% do instantAnalytics.setMeasurementId("G-7DDE6SKB8E") %}
{% do instantAnalytics.setApiSecret('xyz') %}