Best Practices: Configuring Basic Data Analysis for Your Webpage

Establishing reliable data collection is essential for building meaningful analytics. A structured approach ensures that every event you track contributes to accurate, comparable, and actionable insights. Below are best practices to follow when configuring your basic data analysis.


1. Define Clear Measurement Goals

Start by identifying the key business outcomes you want to measure. Common objectives include:

  • Product engagement (views, clicks, category performance)
  • Shopping behavior (add-to-cart, remove-from-cart, checkout progress)
  • Conversion outcomes (completed purchases, order value, repeat buyers)

Example:

  • If your KPI is cart abandonment, you need events like add_to_cart   , remove_from_cart   , and begin_checkout   .
  • If your KPI is product engagement, you should focus on view_item_list   and view_item   .

Tracking only what’s relevant avoids a cluttered dataset.


2. Maintain a Consistent DataLayer

  • Use standardized event names and field keys across all implementations.
  • Keep data types uniform (e.g., always use numbers for value and price fields).
  • Apply a strict structure for product categories (e.g., item_category   , item_category2   , etc.) without substitutions.

Consistency in your dataLayer ensures accurate mappings and reduces troubleshooting later.

Good Example:

{
  "event": "view_item",
  "ecommerce": {
    "currency": "EUR",
    "value": 49.99,
    "items": [
      {
        "item_id": "SKU-123",
        "item_name": "Red Tattoo Ink",
        "item_category": "Tattoo",
        "item_category2": "Pigments"
      }
    ]
  }
}

Bad Example (inconsistent fields):

{
  "event": "view_item",
  "ecom": { "price": "49.99€" },
  "items": [
    { "id": "123", "name": "Red Ink", "category_1": "Tattooing" }
  ]
}

Here, keys (ecom   vs ecommerce   ) and formats (price   as string with €) are inconsistent → making analysis unreliable.


3. Build in Phases

  • Begin with the core purchase journey: view product → add to cart → purchase.
  • Once validated, expand to supporting events such as remove_from_cart, add_shipping_info, and add_payment_info.
  • Test each implementation thoroughly before moving to the next step.

Start simple, expand later.

Phase 1 (core journey):

  • view_item   
  • add_to_cart   
  • purchase   

Phase 2 (enhancements):

  • remove_from_cart   
  • begin_checkout   
  • add_shipping_info   

Validate that each phase works fully before adding more.


4. Reuse Item Mappers

Item mappers should remain identical across all events. This guarantees comparability when analyzing products and categories across the user journey.

Consistent Mapper Example:

"itemMappers": {
  "fullItem": {
    "itemId": "item_id",
    "name": "item_name",
    "price": "price",
    "category": "item_category"
  }
}

This same mapper should apply to view_item   , add_to_cart   , and purchase   .

If you create new mappers for each event, comparisons (e.g., product views vs. purchases) will break.


5. Verify Currency and Transaction IDs

  • Always include ecommerce.currency   for all monetary events. Missing currency can cause reporting inconsistencies.
  • Ensure transaction_id   is unique, present, and accurately reflects the order number. Duplicate or missing IDs lead to inflated or incomplete revenue reporting.

Good Example (purchase):

{
  "event": "purchase",
  "transaction_id": "ORDER-98765",
  "ecommerce": {
    "currency": "EUR",
    "value": 120,
    "shipping": 5,
    "tax": 15,
    "items": [ { ... } ]
  }
}
  • Has currency
  • Has unique transaction ID
  • All values numeric

Bad Example:

{
  "event": "purchase",
  "transaction_id": "",
  "ecommerce": {
    "currency": "",
    "value": "120€"
  }
}

Empty transaction ID + missing currency = broken revenue reporting.


6. Test with Real User Journeys

Simulate real shopping behavior by placing test orders and comparing recorded event data with actual order details. Validate that cart totals, shipping, and tax values match exactly.

Example:

Cart total at checkout = €49.99

dataLayer.push   shows → "value": 49.99   ✅

If it shows "value": 0   ❌ → your tracking is incomplete.


7. Document Your Event Setup

Maintain internal documentation that specifies:

  • Event name (e.g., begin_checkout   )
  • Required fields (currency, value, items, etc.)
  • Trigger location in the customer journey (homepage, PDP, cart, checkout)

This reference ensures consistency across teams and simplifies future updates.

Maintain a simple internal table:

Event Name Required Fields Where It Fires
view_item currency, value, items Product detail page
add_to_cart currency, value, items Cart overlay / button
purchase transaction_id, value, items, currency Thank you page

8. Monitor and Review Regularly

  • Perform monthly reviews of your data collection to confirm that all events are firing correctly.
  • Investigate anomalies promptly, such as sudden drops in add_to_cart rates or missing purchase values.

Example:

  • Last month: 1,200 add_to_cart   events, 500 purchases.
  • This month: 0 add_to_cart   events, 450 purchases.

Likely cause: add_to_cart   tracking broke during a site update.


Clean and consistent implementation is the foundation of trustworthy analytics. By following these best practices, you will establish a stable measurement framework that enables accurate insights and confident decision-making.


Next Step: Best Practices for Structuring Your Event Mapping — Learn how to design a consistent and reusable mapping structure to keep your analytics clean and comparable across all events.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.