# Get statistics per aggregation unit

This feature enables you to aggregate statistics per unit when sending push messages and multicast messages with the same content to multiple end users. "Unit" refers to the aggregation unit. There is no procedure to creating a unit. You can view statistics on a per-unit basis, simply by specifying any unit name when sending the message.

You can get statistics for each unit by assigning a unit name and sending a message:

Workflow for aggregating statistics per unit

# Assign a unit name to any aggregation unit when sending messages

When sending push messages or multicast messages, assign names to aggregation units. For information on sending push messages or multicast messages, see Message in the Messaging API reference.

This is an example of sending a push message assigned a unit name of promotion_a.

curl -v -X POST https://api.line.me/v2/bot/message/push \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {channel access token}' \
-d '{
    "to": "U4af4980629...",
    "messages":[
        {
            "type": "text",
            "text": "Hello, world1"
        }
    ],
    "customAggregationUnits": [
        "promotion_a"
    ]
}'
On assigning unit names later or changing unit names

Once you send a message, you can't retroactively assign or change unit names.

When assigning unit names, make the contents of the message bubble consistent

If you send messages with the same unit name, the statistics are aggregated together, regardless of message contents or the number and order of message bubbles. When sending multiple messages with the same unit name, make sure the contents of the message bubbles are consistent.

# Limit to the number of units that can be used

With the feature for getting statistics per aggregation unit, you can use up to 1,000 different unit names per channel in a given month. Unit numbers are reset on the first day of every month and are counted from 1 again. If you assign more than 1,000 unit names within a given month, you can still send a message, but the new unit name won't take effect.

You can get the number of units used this month by Get number of units used this month.

# Get statistics per unit

You can get statistics on push messages and multicast messages sent assigned unit names by Get statistics per unit.

This is an example of getting statistics for a unit named promotion_a.

curl -v -X GET https://api.line.me/v2/bot/insight/message/event/aggregation \
-H 'Authorization: Bearer {channel access token}' \
--data-urlencode 'customAggregationUnit=promotion_a' \
--data-urlencode 'from=20210301' \
--data-urlencode 'to=20210331' \
-G 

In addition, you can get a name list of units used this month by Get name list of units used this month.