Chord Commerce Event Tracking
Guides
Migrating from Segment to Chord CDP
6min
the only difference between using chord's sdks to send events to chord cdp vs segment is where the events are sent the events will remain exactly the same as a result, only small configuration changes are needed easy! client side / front end events chord analytics library if you're using the @chordcommerce/analytics library on a headless site, your current implementation might look something like this import { chordanalytics } from '@chordcommerce/analytics' import { analyticsbrowser } from '@segment/analytics next' const cdp = analyticsbrowser load({ writekey process env segment write key, }) const chord = new chordanalytics({ cdp, formatters { }, metadata { }, }) // example events chord page() chord trackproductadded({ }) in that case, migrating to chord cdp will involve updating @chordcommerce/analytics to version 1 9 1 or greater removing the @segment/analytics next dependency removing initialization of the cdp variable and configuration option using cdpdomain and cdpwritekey configuration options both to be provided by chord instead using the consent configuration option for built in consent management support (optional) the resulting code will look something like this import { chordanalytics } from '@chordcommerce/analytics' const chord = new chordanalytics({ cdpdomain process env chord cdp domain, cdpwritekey process env chord cdp write key, consent 'shopify', // optional formatters { }, metadata { }, }) // example events (unchanged) chord page() chord trackproductadded({ }) running both in parallel it is possible to send every event to both chord cdp and segment at the same time this is useful for running a side by side comparison of event data during migration it also buys more time when migrating destinations the resulting code would be a combination of the two examples above; for example import { chordanalytics } from '@chordcommerce/analytics' import { analyticsbrowser } from '@segment/analytics next' const cdp = analyticsbrowser load({ writekey process env segment write key, }) const chord = new chordanalytics({ cdp, cdpdomain process env chord cdp domain, cdpwritekey process env chord cdp write key, formatters { }, metadata { }, }) // example events (unchanged) chord page() chord trackproductadded({ }) once the validation and migration are complete, the segment code can be safely removed to match the second example shopify web pixel if you're using chord's shopify web pixel either for a fully liquid site or just for checkout extensibility we will provide an updated web pixel that supports chord cdp chord oms sdks if your storefront is built on chord oms using the gatsby or next js starterkits, the chord team will help you swap the segment snippet for the chord cdp snippet server side / back end events regardless of oms, chord will assist in the migration of server side/back end events it will be an equally simple process, but the actual implementation will vary based on the current architecture