> 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/email-signup.md).

# Email Signup

{% embed url="<https://www.loom.com/share/e1e80823bcad4c06b207720cef906b51?sid=3f9e7bae-29d1-4216-a749-bd9dd06623d3>" %}

## Form Event

The `form` event can be used to track user information. To track a form submission event, use the track function with "form" 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`. The `parameters` field can contain an email or a telegram username, optionally including the user's name.

{% 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).
{% endhint %}

| parameters | TYPE   | USE                                             | DESCRIPTION                                              |
| ---------- | ------ | ----------------------------------------------- | -------------------------------------------------------- |
| email      | string | <mark style="color:red;">**Required**</mark> \* | \*optional when telegram is set                          |
| telegram   | string | <mark style="color:red;">**Required**</mark> \* | <p>Telegram username<br>\*optional when email is set</p> |
| name       | string | Optional                                        |                                                          |

Example only with required email field:

```javascript
safary.track({
  eventType: "form",
  eventName: "newsletter-signup",
  parameters: { 
    email: "user@example.com"
  }
})
```

Example only with required telegram field:

```javascript
safary.track({
  eventType: "form",
  eventName: "telegram-signup",
  parameters: { 
    telegram: "user123"
  }
})
```

Example with optional name field included:

```javascript
safary.track({
  eventType: "form",
  eventName: "newsletter-signup",
  parameters: { 
    email: "user@example.com",
    name: "John Doe"
  }
})

safary.track({
  eventType: "form",
  eventName: "telegram-signup",
  parameters: { 
    telegram: "user123",
    name: "Jane Doe"
  }
})
```

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.
```
