# FastStats configuration

Before configuring Twitter in FastStats, make sure you've created a Social database (see [Twitter prerequisites](<https://help.apteco.com/en/admin/integration/social/twitter/#creating-a-social-database>)).

## FastStats Service configuration

Open the **FastStats Configurator**:

To configure the Social database connection for the FastStats Service:

1. Select **FastStats Services**.
2. Select the **System** tab.
3. Select the **Twitter** node.
4. Select **File** \> **Save** to save the changes.

| Setting | Description |
| --- | --- |
| Database Connection String | Automatically picks up the connection string from the Social database. |
| Image/Media upload timeout (seconds) | Timeout for uploading images or video to a Twitter Handle. Increase if your network is slow or you are using large files. |
| Image/Media upload filesize limit (MBs) | The maximum file size for Twitter is 5 MB. |
| Ad country codes | Default country codes for targeting custom audiences in adverts. You can also set this per channel in PeopleStage. |
| Ads campaign retry interval (minutes) | How often PeopleStage checks with Twitter whether the audience has loaded successfully. |
| Ads campaign maximum retry period (hours) | How long the service retries connecting to Twitter for audience upload progress before stopping. |

## FastStats Web Service configuration

Define the Social database connection string for the FastStats Web Service.

## FastStats roles configuration

Roles control access to Twitter functions.

### Twitter Administrator role

A Twitter Administrator can modify Apps, modify Handles, and manage tokens.

1. In **Users Explorer**, right-click on an administrator.
2. Select **Modify** \> **Modify Roles**.
3. Select both the **Twitter Administrator** and **Twitter User** roles.
4. Select **Close**.

### Twitter User role

A Twitter User can manage tokens within Administrative Functions.

1. In **Users Explorer**, right-click on a username.
2. Select **Modify** \> **Modify Roles**.
3. Select the **Twitter User** role.
4. Select **Close**.

## Administrative functions

Administrative functions are available from **File** \> **Tools** \> **Administrative Functions**.

A user with the Twitter Administrator role can Modify Apps, Modify Handles, and Manage Tokens. A user with only the Twitter User role can only Manage Tokens.

### Modify Apps

FastStats requires the Twitter App Id, Consumer Key, and Consumer Secret so users can obtain the correct Access Tokens. This uses FastStats' built-in Twitter login mechanism.

Obtain these from the [Twitter Developer portal](<https://developer.twitter.com>).

- To add a new App, select **Add New Twitter App**
- To edit an existing App, select **Edit** next to the App Name

Apteco provides a shared Twitter App. To use it, select **Use the Apteco twitter app**. FastStats automatically populates the name and hides the App Id, Consumer Key, and Consumer Secret fields.

| Field | Description |
| --- | --- |
| Name | Used internally within FastStats; should match the app name in the Twitter Portal (or "Apteco" if using the Apteco App) |
| App Id | The Twitter App Id (only required if using your own app) |
| Consumer Key | The Twitter App Consumer Key (only required if using your own app) |
| Consumer Secret | The Twitter App Consumer Secret (only required if using your own app) |
| Redirect URI | Used for click-through actions from Twitter; typically your brand's home page |

### Modify Handles

To find your Twitter Handle, log in to Twitter and select your profile picture. Your Handle appears under your name, starting with @.

1. To add a new Handle, select **Add New Twitter Handle**.
2. To edit an existing Handle, select **Edit**.
3. Enter the Twitter **Handle Username**.

### Twitter capabilities configuration

This configuration lets FastStats users log in to their Twitter profile and generate user access tokens for Apps and Handles.

In **Users Explorer**, right-click on a user and select **Modify** \> **Modify Capabilities** \> **Modify Twitter Capabilities**.

**Manage Ads**: select to let the user publish adverts, upload custom audiences, and gather adverts statistics.

**Tweets**: select to let the user publish tweets and gather tweet responses.

### Manage Tokens

A Twitter User role can see the Apps and Handles assigned by an administrator.

When you first access the Manage Tokens dialogue, select **Generate**.

The Twitter login dialogue opens. Enter your Twitter credentials. FastStats stores these as a token.

After successfully logging in, close the dialogue. The **Valid** check-boxes for the App and branded Handles show as ticked once FastStats validates the tokens.

If tokens become invalid, select **Re-Generate** to request a new set.

> [!NOTE]
>
> Without valid tokens stored in FastStats, it's impossible to create Tweets or Adverts activities in PeopleStage.
