> For the complete documentation index, see [llms.txt](https://safary-1.gitbook.io/safary-doc-2.0/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://safary-1.gitbook.io/safary-doc-2.0/connect-data/social-logins/twitter-auth.md).

# Twitter Auth

## Social Login Event

The `social_login` event can be used to track information regarding logins made using socials. To track a social login event, use the track function with "social\_login" as the `eventType`, and any appropriate name as `eventName`, and make sure to add the <mark style="color:red;">**required**</mark> attributes in the field `parameters`.&#x20;

The `parameters` field should contain at least one of the three possible fields: `twitterUsername`, `lensHandle` and `farcasterId` described below. (note these field names are **case sensitive**).

{% hint style="info" %}
&#x20;You can also add any other desired fields in `parameters` as long as you follow the guidelines in the [Custom Parameters subsection](#custom-parameters). See examples below for this event.
{% endhint %}

<table><thead><tr><th width="178">parameters</th><th width="91">TYPE</th><th width="199">USE</th><th>DESCRIPTION</th></tr></thead><tbody><tr><td>twitterUsername</td><td>string</td><td><mark style="color:red;"><strong>Required</strong></mark> *<br>*Optional when <code>lensHandle</code> or <code>farcasterId</code> is set</td><td>Twitter/X username.<br>For example, for <a href="https://x.com/Safaryclub">https://x.com/safaryclub</a>, send only "safaryclub".</td></tr><tr><td>lensHandle</td><td>string</td><td><mark style="color:red;"><strong>Required</strong></mark> *<br>*Optional when <code>twitterUsername</code> or <code>farcasterId</code> is set</td><td>Lens handle without the namespace. <br>For example, for <a href="https://hey.xyz/u/ricardocarvalho">https://hey.xyz/u/ricardocarvalho</a><br>send only "ricardocarvalho"</td></tr><tr><td>farcasterId</td><td>number</td><td><mark style="color:red;"><strong>Required</strong></mark> *<br>*Optional when <code>twitterUsername</code> or <code>farcasterId</code> is set</td><td>Farcaster ID (aka FID).<br>For example, for <a href="https://farcaster.xyz/jhv">https://farcaster.xyz/jhv</a> click on the three dots and then click on "About" to see the FID of 1385.</td></tr></tbody></table>

Example only with required `twitterUsername` field:

```javascript
safary.track({
  eventType: "social_login",
  eventName: "login-using-twitter",
  parameters: { 
    twitterUsername: "elonmusk"
  }
})
```

Example only with required `lensHandle` field:

```javascript
safary.track({
  eventType: "social_login",
  eventName: "login-using-lens",
  parameters: { 
    lensHandle: "ricardocarvalho"
  }
})
```

Example only with required `farcasterId` field:

```javascript
safary.track({
  eventType: "social_login",
  eventName: "login-using-farcaster",
  parameters: { 
    farcasterId: "jhv"
  }
})
```

Please note that the `parameters` field can also include any other information you believe is useful to track, as long as you follow the guidelines in the [Custom Parameters subsection](#custom-parameters).

See the last section of this page for troubleshooting.

***

## Troubleshooting

Required arguments:

* Note that `eventType` + `eventName` are required arguments for `safary.track` .
* Therefore, for example, the following would **not** work:

```tsx
safary.track( { eventName: "main offer" } )
// Gives:
// ERROR: safary.track(): eventType is undefined.
```

Required format:

* Note that the `parameters` used in the both tracking functions is required to be an **object.**
* Therefore, for example, passing a **string** as `parameters` would **not** work:

```tsx
safary.track( { eventType: "buy", eventName: "main offer", parameters: "ETH" } )
// Gives:
// ERROR: safary.track(): parameters is not an object.
```
