Skip to content

Feature Request: X Premium Analytics #613

Closed as not planned
Closed as not planned

Description

@Timtendo12

Feature Request: X Premium Analytics

Hey! I would like to request the feature to fetch analytic data for the account. This might be a big feature so I will (if needed) be able to help you implement this in core and the API. I've already figured out most of the API endpoints needed to fetch the data.

The analytic internal API is divided in 3 sections

  • Overview -> Overview of all the accounts analytics
  • (User) Audience -> Information about the audience of the account
  • Content -> Analytic per tweet

Overview

URL:

https://x.com/i/api/graphql/NlJ6RM-hgHxt-iu9cPQz7A/overviewDataUserQuery

Payload:

{
    "rest_id": "715786798056779776",
    "requested_metrics": [
        "Engagements",
        "Impressions",
        "ProfileVisits",
        "Follows",
        "VideoViews",
        "Replies",
        "Likes",
        "Retweets",
        "MediaViews",
        "Bookmark",
        "Share"
    ],
    "to_time": "2024-09-15T00:00:00.000Z",
    "from_time": "2024-09-01T00:00:00.000Z",
    "granularity": "Daily"
}
Property Type Description Example Value
rest_id String Rest ID 715786798056779776
requested metric String[] n/a "Engagements"
to_time Timestamp End date timestamp to request analytic data from 2024-09-15T00:00:00.000Z
from_time Timestamp Start date timestamp to request analytic data from 2024-09-1T00:00:00.000Z
granularity String Determines the level of detail for the analytic report. If set to "Daily", it will return daily reports of analytic numbers between from_date and to_date. Other possible values could be "Weekly" or "Monthly" for different levels of aggregation. "Daily

Response:

{
    "data": {
        "result": {
            "result": {
                "__typename": "User",
                "organic_metrics_time_series": [
                  // ...
                ],
                "id": "{{  User:{ID} but decoded as base64  }}"
            },
            "id": "VXNlclJlc3VsdHM6NzE1Nzg2Nzk4MDU2Nzc5Nzc2"
        }
    }
}

organic_metrics_time_series response object

[
    "metric_values": [
        {
            "metric_value": "{{ VALUE:INT }}",
            "metric_type": "{{ TYPE:STRING }}"
        },
    ],
    "timestamp": {
        "iso8601_time": "2024-09-01T00:00:00Z"
    }
]

You still have the other 2 pages left, However I don't think they supply information that someone needs daily,weekly or monthly so for now we could skip that one and focus on this. LMK If you need more information or want help.

Activity

  1. Rishikant181 commented on Sep 16, 2024

    @Rishikant181
    Owner

    Thanks for the information. Unfortunately, I don't have X premium to test it out or implement it and it seems X doesn't have any trial for X premium which might have helped me implement this feature.

    Still, I'll be keeping this issue open in case someone with premium is willing to work on this.

  2. Timtendo12 commented on Sep 16, 2024

    @Timtendo12
    Author

    I'll probaly be able to take a look into it.

  3. Timtendo12 commented on Sep 17, 2024

    @Timtendo12
    Author

    Started working on this in both Core and API.

  4. Rishikant181 commented on Sep 17, 2024

    @Rishikant181
    Owner

    @Timtendo12 Sorry for the late reply.

    Once you add the request config and the associated types in rettiwt-core, ping me so I'll make a new alpha release of rettiwt-core which we can then use to make the same changes on rettiwt-api.

  5. Timtendo12 commented on Sep 17, 2024

    @Timtendo12
    Author

    @Timtendo12 Sorry for the late reply.

    Once you add the request config and the associated types in rettiwt-core, ping me so I'll make a new alpha release of rettiwt-core which we can then use to make the same changes on rettiwt-api.

    Don't worry about it! :)

    I’ve submitted a PR for the core. Since this is my first time working on this project, I’d appreciate any critical feedback.

    Rishikant181/Rettiwt-Core#185

  6. Rishikant181 commented on Sep 17, 2024

    @Rishikant181
    Owner

    @Timtendo12 Rettiwt-Core v4.4.0-alpha.0 has been released with the required request configuration. The request config can be accessed by the user.analytics endpoint of rettiwt-core. You may use that alpha package to develop the feature in Rettiwt-API.

    Ping me if you need an explanation on how to go about implementing those changes OR I can implement those by going in blind and ask you to test it :P

  7. Timtendo12 commented on Sep 17, 2024

    @Timtendo12
    Author

    I'll see if I can figure it out.

  8. Rishikant181 commented on Jun 15, 2025

    @Rishikant181
    Owner

    Closing this issue as stale

  9. vachmara commented on Jun 29, 2025

    @vachmara
    Contributor

    Hey @Rishikant181,

    Assign me on this, I will finish @Timtendo12 implementation only on the overview page for the moment. And it could be interesting also to add audience and content in a second time.

    The endpoint changed. The payload slightly changed too, there is no rest_id anymore but there is show_verified_followers.
    Same the requestedMetrics changed too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions