The Data Layer Connector is CHEQ’s front-end mechanism designed to communicate CHEQ information with a website’s front-end so it can be used by tag managers or other site code. This connector is designed to send the user payload to the browser as soon as a user is classified. That’s usually pretty quick, but is also subject to race conditions.
Data Layer Push
This uses an event-driven data layer methodology to push a JSON object payload into an array. It is the standard method of pushing data into Google Tag Manager and also compatible with popular Adobe Data Collection Tags extensions (like Adobe Client Data Layer).
Field Definitions
Field | Type | Description |
Object Name | string | Specifies the name of the data layer array object (can be an existing object). |
Event Name | string | Specifies the name of the event that is pushed into the data layer, which helps the tag management system listen for the updated data. |
Key | string | Specifies the name of the variable and can have any name using valid variable charsets. |
Value | selection | Dynamically returns the value of the corresponding key. |
Example Payload
Input
Field | Value |
Object Name | myDataLayer |
Event Name | Cheq Response |
Key | agentType |
Value | Threat Type |
Output
myDataLayer.push({
"event":"Cheq Response",
"agentType":"Crawler"
})
Local Storage
This uses the Local Storage methodology to push a key:value pair into your browser's local storage. It is accessible by any system that can view and reference local storage objects.
Field Definitions
Field | Type | Description |
Event Name | string | Specifies the name of the JavaScript event that is pushed from the <body> tag, which helps the tag management system listen for the updated data. |
Key | string | Specifies the name of the variable and can have any name using valid variable charsets. |
Value | selection | Dynamically returns the value of the corresponding key. |
Example Payload
Input
Field | Value |
Event Name | Cheq Response |
Key | agentType |
Value | Threat Type |
Output
localStorage.setItem('agentType', 'crawler');
const cheqEvent = new Event('Cheq Response');
document.body.dispatchEvent(cheqEvent);
Important Considerations
Race Conditions
Race conditions are a key consideration when using the Data Layer connector, as the session will not be classified if it isn’t classified as Valid/Malicious before the analytics server call is sent. This increases Unspecified values in Adobe or (not set) values in Google Analytics. This outcome is normal and expected when working in an asynchronous environment. Our powerful detection engine also factors behavioral data into classification, meaning it might need some extra time to unambiguously diagnose traffic.
There are steps one can take to increase coverage:
- Trigger the CHEQ library code before the analytics code.
- This is recommended for all implementations leveraging the Data Layer connector as the primary means of traffic classification. If the CHEQ code loads after analytics code without supplemental events, the classification rate will be very low.
- Send an event on classification.
- This eliminates the race condition by sending an event to the analytics tool whenever a classification is returned. This occurs only once per user for the vast majority of cases. There could be cost implications of sending extra events to analytics tools, so please be aware of contract guardrails before implementing.
- Leverage the Cloud Storage connector
- The Cloud Storage connector is the most permanent solution and CHEQ’s recommended means of analytics integration. CHEQ sends batches of user data directly into your analytics tool at a cadence as frequent as hourly. This data is propagated several ways, one of which is via user-specified User ID passed in via CHEQ’s JavaScript SDK.