With a Google Tag Manager implementation, you get automatic access to Apollo's data layer validation. This feature requires no additional configuration and is available when you deploy to your GTM container.

Data Layer Validation

When an Apollo event is pushed to the Data Layer, the payload of that event will be validated against a JSON schema that describes the expected fields, data value, and data type constraints. When an invalid payload is detected, you will see the error logged to the console and if configured, sent to airbrake.

After you deploy your Apollo property to GTM, you will find the Apollo Data Quality template. This template contains the logic for data layer validation.

You will also see the Apollo Data Quality (init) tag, which fires the custom template. The tag is fully configured by Apollo, so you do not need to change anything. Under the Event Name field, you will see the list of events in your implementation that will be validated.

If you enable the Product Added to Cart event and currency attribute, Apollo will expect to see currency as a string parameter when Product Added to Cart is pushed to the data layer. If your currency attribute was set to a number instead, you would see the following error logged in the console and/or airbrake:

If the payload is valid, you will not see any messaging in the console.

Data Layer Validation Schemas

If you are interested in viewing your validation schemas, you may do so by opening the build drawer and clicking the diagram icon following a successful deployment.

In the modal, click an event to download its validation schema.

Did this answer your question?