# Chroma Analytics vs Adobe Analytics direct ## Why chroma-analytics exists As a way to remove some of the time and complexity to setup analytics in applications we decided to "bake" analytics events into our components and pass the resulting generated analytics event object to a site tracking function that was created by the site tracking team. In theory this sped up the delivery time of teams but the reality is that you end up with very generic data in a lot of cases being passed to Adobe and not a lot of control and granularity required for our complex use cases. eg. A Chroma Button might generate an analytics event that looks like this: ``` { componentType: 'Button', action: 'Click', tagType: 'button', tagName: { id: 'send-button', name: 'send-button', class: 'btn', label: 'Send', }, } ``` As you can see this doesn't really give you much context of the operation of the button. ## A better way It would be much more useful to generate a specific analytics string based on the button action and send that directly to Adobe Analytics: ``` // publish helper function to be shared across apps const publishAdobeEvent = (event: string, pageId: string, data: any) => { window.iagDataLayer.push({ event: event, pageId: pageId, data: data }); }; publishAdobeEvent(event: 'form-submit', pageId + "vehicle-details", { form_interaction: vehicleInteraction + "User submitted vehicle details" }); ``` By using Adobe Analytics in this way it removes the uncertainty of a middleware layer having to transform values, adds complete flexibility and control to developers and directly uses the industry standard tool's methods. Furthermore the site tracking team identified a certain set of Chroma components to bake in some tracking functionality, Chroma has since moved on to a completely new codebase with a more scalable & flexible approach and using an Enterprise tool directly fits in much better with this philosophy and future proofs site tracking in IAG applications. ## What if we move to another Analytics platform? This actually doesn't matter either way, Chroma is platform agnostic but also using the direct method should be relatively easy to migrate across to another analytics platform. ## How do I get started with Adobe Analytics We need to identify who is the point of contact for teams to setup their project in Adobe Analytics and make this information available in Confluence and referenced from project docs such as the Chroma documentation website. The Carbon Offset app has been built using Adobe Analytics directly and is a great reference app: Adobe utils https://chuck.auiag.corp/projects/BUYONE/repos/carbon-offset-ui/browse/src/app Publish event in action: https://chuck.auiag.corp/projects/BUYONE/repos/carbon-offset-ui/browse/src/components/OffsetCalculate.tsx