Chord Commerce Event Tracking
...
Guides
Integrations

Google Analytics 4

6min
segment has two ga4 destinations, the google analytics 4 web destination and the google analytics 4 cloud destination the google analytics 4 web destination can only be connected to website front end segment sources when enabled, segment will load the gtag js library for you and sends tracking events to ga4 via gtag js the google analytics 4 cloud destination can be connected to any segment source, and sends tracking events directly to google’s measurement protocol api we recommend configuring two ga4 segment destinations to capture events from both the website front end, which sends events for browsing activity, and from chord's server source, which sents events for transactions in the oms this will give you the fullest picture of user activity in ga4 using with chord’s server source add a google analytics 4 cloud destination destination and connect to your chord server source be sure to enter your measurement id and api secret in the destination settings to send segment events to ga4 events, we need to add mappings select add mapping in the destination configuration to add pre built mappings and actions the following pre built mappings are supported by the chord server source begin checkout maps to chord’s checkout started purchase maps to chord’s order completed refund maps to chord’s order refunded identifying users the default mappings for the google analytics 4 cloud destination do not include the enough data for ga4 to be able to connect the events to website front end activity there are two additional event mappings you can add to fix this, the google client id and the user's id client id to tie together front end and server segment events as one session within ga4, you can send the gtag generated client id from the front end as the client id with the server events chord includes the gtag generated client id from the front end on server events as the property integrations google analytics clientid to sent the client id to ga4, edit each mapping and find the client id property it is blank by default client id mapping select the text input to the left, and in the event variables search bar, enter the text integrations google analytics clientid unless you have test data loaded, it will likely say "not matches found," which is fine select use "integrations google analytics clientid" as an event variable client id mapping selected now you should see this client id mapping completed if events throw "client id is required for web streams" errors, it is because the destination requires a client id for all events this is happening because the corresponding session must not have had front end events with a synced client id to remedy this, you can use segment's coalesce function to fall back to the userid , similar to what the destination would have used by default, as documented here user id optionally, you can send the segment user id, which is typically the user or customer id from the oms, to ga4 with every event for an authenticated user (the user id is not available for guest activity ) this allows ga4 to connect user behavior across sessions and devices to sent the user id to ga4, edit each mapping and find the user id property it is blank by default select the text input to the left, and in the event variables search bar, enter the text userid now you should see user id mapping using with chord’s website front end source add a google analytics 4 web destination and connect to your website front end source select add mapping in the destination configuration to add pre built mappings and actions the following pre built actions can be added without any adjustment to the mappings, if chord is sending the corresponding event to segment add to cart maps to chord’s product added search maps to chord’s products searched select item maps to chord’s product clicked view item list maps to chord’s product list viewed sign up maps to chord’s signed up view cart maps to chord’s cart viewed purchase maps to chord’s order completed view promotion maps to chord’s promotion viewed add to wishlist maps to chord’s product added to wishlist remove from cart maps to chord’s product removed select promotion maps to chord’s promotion clicked view item maps to chord’s product viewed begin checkout maps to chord’s checkout started login maps to chord’s signed in identifying users optionally, you can send the segment user id, which is typically the user or customer id from the oms, to ga4 with every event for an authenticated user (the user id is not available for guest activity ) this allows ga4 to connect user behavior across sessions and devices to sent the user id to ga4, edit each mapping and find the user id property it is blank by default select the text input to the left, and in the event variables search bar, enter the text userid now you should see user id mapping