Skip to main content

Network Request Validation

DLest can intercept and validate actual network requests to analytics platforms, ensuring your implementation sends correct data before it reaches production.

Features

GA4 Network Validation

DLest intercepts requests to Google Analytics 4 and validates:

  • Event names: Must be ≤40 characters, start with letter, alphanumeric + underscore only
  • Parameter limits: Max 25 custom parameters per event
  • Parameter names: Must be ≤40 characters
  • Parameter values: String values must be ≤100 characters (≤500 for page_location, page_referrer, page_title)
  • User properties: Max 25 user properties
  • Item parameters: Max 10 custom parameters per item
  • Reserved parameters: Warns when using Google's reserved parameter names
  • Measurement ID format: Validates G-XXXXXXXXXX format

Universal Analytics Deprecation Detection

Automatically detects and flags Universal Analytics (UA) implementations as errors since UA was discontinued on July 1, 2023.

Usage

Basic Network Validation

test('validate GA4 implementation', async ({ page, network }) => {
await page.goto('https://example.com');

// Check that event was sent
await expect(network).toHaveGA4Event('purchase');

// Get events for detailed validation
const events = network.getGA4Events();
const purchaseEvents = network.getGA4EventsByName('purchase');
});

Using the GA4 Validator

const GA4Validator = require('dlest/validators/ga4-validator');
const validator = new GA4Validator({ checkReserved: true });

test('validate GA4 limits', async ({ page, network }) => {
await page.goto('https://example.com');

const events = network.getGA4Events();

events.forEach(event => {
const validation = validator.validateHit(event);

if (!validation.valid) {
console.log('Errors:', validation.errors);
console.log('Warnings:', validation.warnings);
}
});
});

Common Validation Errors

Error TypeDescriptionSolution
INVALID_EVENT_NAMEEvent name > 40 chars or invalid formatShorten name, use only letters, numbers, underscores
TOO_MANY_PARAMETERSMore than 25 custom parametersReduce parameters or use user properties
INVALID_PARAMETER_NAMEParameter name > 40 charsShorten parameter name
INVALID_STRING_VALUEString value exceeds limitTruncate to 100 chars (500 for page_* params)
DEPRECATED_UNIVERSAL_ANALYTICSUsing discontinued UAMigrate to GA4 immediately

Next Steps