dotCMS / dotCMS/core

[DEFECT] CA: Custom attribute added to the analytic_custom_attributes table even when Event data is invalid

Open
#33,379 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

dotCMS : Analytics Priority : 2 High Team : Falcon
Dominant language
Java
Stars
970
Forks
486
Avg merge
3d 33m
Merged PRs (30d)
170

Description

Problem Statement

When sending a CA Event with a Custom Attribute and you don't specify the required attributes Event Type, dotCMS is still keeping track of the custom attribute in the analytic_custom_attributes database table. This should not happen because the Event data is invalid, meaning no custom attribute should be registered at all.

Steps to Reproduce
  • Set up both the Experiments and Content Analytics Apps.
  • Using Postman, send the following data via POST:
    • URL: {{serverURL}}/api/v1/analytics/content/event
    • Body:
{
    "context": {
        "site_key": "{YOU-CONTENT-ANALYTICS-SITE-KEY}",
        "session_id": "16AB7DB3809BD1F78F1585DD03038581",
        "user_id": "anonymous"
    },
    "events": [
        {
            "event_type": "pageview",
            "local_time": "2025-09-10T11:45:00-06:00",
            "data": {
                "page": {
                    //"url": "http://www.yoursite.com/index#guidelines?param=value", COMMENTING REQUIRED ATTRIBUTE
                    "doc_encoding": "UTF8",
                    "title": "Your Official Site - hola",
                    "language_id": "1",
                    "persona": "ANY_PERSONA",
                    "doc_path": "...",
                    "doc_host": "...",
                    "doc_protocol": "...",
                    "doc_hash": "...",
                    "doc_search": "..."
                },
                "device": {
                    "screen_resolution": "1280x720",
                    "language": "en",
                    "viewport_width": "1280",
                    "viewport_height": "720"
                },
                "custom": {
                   "custom_attribute_1": "custom value 1"
                 }
            }
        }
    ]
}
  • An error is returned in the HTTP Response, which is correct. However, if you check the analytic_custom_attributes table, you'll see that a new record for the invalid Event Type has been created:
dotcms=# select * from analytic_custom_attributes;
      event_type       |                                                 custom_attribute                                                 
-----------------------+------------------------------------------------------------------------------------------------------------------
 pageview               | {"custom_attribute_1": "custom_1"}
(1 row)
Acceptance Criteria
  • Keep the error from adding the record to the analytic_custom_attributes table. This takes up Custom Attribute columns in the ClickHouse DB unnecessarily.
  • Create Postman tests to keep this from happening.
dotCMS Version

Latest main.

Severity

High - Major functionality broken

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the invalid event against /api/v1/analytics/content/event using the Postman request in the issue, then trace where analytic_custom_attributes is updated. Add Postman coverage for the missing required page URL and verify the request still errors without creating a database record.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, postman
Domain
api, backend, databases, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
40/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.