Skip to content

Instantly share code, notes, and snippets.

@abfo
Last active November 13, 2022 21:17
Show Gist options
  • Save abfo/63828baff98b6ca980c48bec8b53f62d to your computer and use it in GitHub Desktop.
Save abfo/63828baff98b6ca980c48bec8b53f62d to your computer and use it in GitHub Desktop.
Send Google Analytics event parameters with every event to more than one tag - see https://ithoughthecamewithyou.com/post/send-event-parameters-with-every-event-and-multiple-tags-in-google-analytics-4
// from https://developers.google.com/analytics/devguides/collection/ga4/event-parameters?client_type=gtag
gtag('set', {
'page_title': 'Travel Destinations',
'currency': 'USD'
});
// Place your config commands after the set command like follows
gtag('config', 'G-XXXXXXXXXX-1');
gtag('config', 'G-XXXXXXXXXX-2');
gtag('config', 'G-XXXXXXXXXX-3');
// that doesn't work for me, instead I do:
var eps = {'page_title': 'Travel Destinations', 'currency': 'USD'};
gtag('config', 'G-XXXXXXXXXX-1', eps);
gtag('config', 'G-XXXXXXXXXX-2', eps);
gtag('config', 'G-XXXXXXXXXX-3', eps);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment