Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Actions/Pages: Unique pageviews shouldn't be summed up in hierarchical view  #10127

@adaqus

Description

@adaqus

This is a db query used when creating Actions/Pages report:

SELECT
            /* Actions */
            log_action.name,
            log_action.type,
            log_action.idaction,
            log_action.url_prefix,
            count(DISTINCT log_link_visit_action.idvisit)   AS `2`,
            count(DISTINCT log_link_visit_action.idvisitor) AS `1`,
            count(*)                                        AS `12`,
            sum(
                CASE WHEN custom_float IS NULL
                  THEN 0
                ELSE custom_float
                END
            ) / 1000                                        AS `30`,
            sum(
                CASE WHEN custom_float IS NULL
                  THEN 0
                ELSE 1
                END
            )                                               AS `31`,
            min(custom_float) / 1000                        AS `32`,
            max(custom_float) / 1000                        AS `33`,
            CASE WHEN (MAX(log_link_visit_action.custom_var_v5) = 0
                       AND log_link_visit_action.custom_var_k5 = '_pk_scount')
              THEN 1
            ELSE 0 END
                                                            AS `28`,
            SUM(CASE WHEN log_action_name_ref.type = 8
              THEN 1
                ELSE 0 END)
                                                            AS `29`
          FROM
            piwik_log_link_visit_action AS log_link_visit_action
            LEFT JOIN piwik_log_action AS log_action
              ON log_link_visit_action.idaction_url = log_action.idaction
            LEFT JOIN piwik_log_action AS log_action_name_ref
              ON log_link_visit_action.idaction_name_ref =
                 log_action_name_ref.idaction
          WHERE
            log_link_visit_action.server_time >= ?
            AND log_link_visit_action.server_time <= ?
            AND log_link_visit_action.idsite = ?
            AND log_link_visit_action.idaction_url IS NOT NULL AND
            log_link_visit_action.idaction_event_category IS NULL
          GROUP BY
            log_action.idaction
          ORDER BY
            `12` DESC, name ASC

In this query for each action type (group by log_action.idaction) number of unique visits is counted (count(DISTINCT log_link_visit_action.idvisit) AS 2). So when we have a visit with pageviews on /category1/sub1 and /category1/sub2, for each pagieview we have one unique visit (unique pageview). Category1 also has 1 unique visit, but it will be shown it has 2.

actions-pages

Values underlined (and each expandable element) are sums of unique pageviews from subelements, so some visits are counted more than once.

This will probably also apply to other reports from Actions group.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions