Skip to content

[DEFECT] Conversion are counting multiples times #34142

@freddyDOTCMS

Description

@freddyDOTCMS

Problem Statement

Sometimes the conversion are counting multiples times by the content_presents_in_conversion_mv.

This os really a particular case that is describe in the Steps to Reproduce section.

Steps to Reproduce

The content_presents_in_conversion_mv is a refreshable view that run every 15 minutes, so to run this example maybe you are going to want to get this time down to 5 minutes or less, so to do this you have to:

and down it to 5 or whatever you want.

  • Later you need to connect to your ClickHouse database and delete the View with this statement:

drop VIEW content_events_counter_mv;

  • Finally You need to run the statement you change in the first steps and that is it is done

(Important note here if you sent it to 5 minutes it does not means that it is going to executed 5 minutes later, for example If you change it at 12:37 PM then it is going to be executed at 12:40 that first time and later each 5 minutes)

ok, now let go with the steps by steps to reproduce the bug:

  • Send a content_impression event using the follow payload:

{
    "context": {
        "site_auth": "DOT.8a7d5e23-da1e-420a-b4f0-471e7da8ea2d.XPPRJgzOIFlXZDfQR_qovElLX",
        "session_id": "abc",
        "user_id": "xxx",
        "device": {
            "screen_resolution": "1280x720",
            "language": "en",
            "viewport_width": "1280",
            "viewport_height": "720"
        }
    },
    "events": [
        {
            "event_type": "content_impression",
            "local_time": "2025-12-17T09:01:00+02:00",
            "data": {
                "page": {
                    "url": "http://localhost/aaaaa",
                    "title": "aaaa Page"
                },
                "content": {
                    "identifier": "6",    
                    "inode": "2", 
                    "title": "this is a title 6",      
                    "content_type": "A"
                },
                "position": {
                    "viewport_offset_pct": 18, 
                    "dom_index": 5 
                },
                "custom": {
                    "A": "B"
                }
            }
        }
    ]
}

remember use the right user_auth according to your environment

  • Wait until the View get executed.
  • Now create another content_impresion event, you can used the same payload before but remember to change the local_time attribute, used the follow value: "2025-12-17T09:02:00+02:00"
  • Create a Conversion event using the follow payload

{
    "context": {
        "site_auth": "DOT.8a7d5e23-da1e-420a-b4f0-471e7da8ea2d.XPPRJgzOIFlXZDfQR_qovElLX",
        "session_id": "abc",
        "user_id": "xxx",
        "device": {
            "screen_resolution": "1280x720",
            "language": "en",
            "viewport_width": "1280",
            "viewport_height": "720"
        }
    },
    "events": [
        {
            "event_type": "conversion",
            "local_time": "2025-12-17T09:03:00+02:00",
            "data": {
                "conversion": {
                    "name": "ddd"
                },
                "page": {
                    "url": "http://localhost/aaaaa",
                    "title": "aaaa Page"
                },
                "custom": { //optional, any data that the customer want to add to rich the event data
                        "name": "purchase",
                        "value": 99.99,
                        "currency": "USD",
                        "category": "ecommerce"
                }
            }
        }
    ]
}
  • Wait until the View get executed again.
  • Go to the Analytics Search portlet and run the follow CubeJS Query

{
   "dimensions": [
       "Conversion.conversionName",
       "Conversion.totalConversion",
       "Conversion.convRate",
       "Conversion.topAttributedContent"
   ]
}

You are going to got the follow answers:


[
  {
    "Conversion.convRate": "100",
    "Conversion.conversionName": "ddd",
    "Conversion.topAttributedContent": [
      {
        "conv_rate": "300",
        "conversions": "3",
        "event_type": "content_impression",
        "events": "2",
        "identifier": "6",
        "title": "this is a title 6"
      }
    ],
    "Conversion.totalConversion": "1"
  }
]

How you can see conversions is equals to 3, but really we have just one conversions, it is wrong.
Important If you skip the steps to wait until the job get executed after send the first content_impression all work right

Acceptance Criteria

  • conversions should be 1

dotCMS Version

latest in main

Severity

Critical - System unusable

Metadata

Metadata

Assignees

Type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions