# Triggers

## Installation

Simply include the trigger script after the end of your body

```markup
<script src="https://static.gramchat.me/triggers.gram.js"></script>
```

{% hint style="info" %}
Please keep in mind, that you need an already setup gramchat for this trigger functions to work
{% endhint %}

## MessageOnScrollPercent(percent, message)

Automatically open gramchat and prompt the user with a message if he/she scrolled down on your page for a certain percentage

```markup
<script>
MessageOnScrollPercent(80, "This message will pushed to gramchat 
if the user scrolled down 80% of the page");
</script>
```

## MessageOnMouseLeave(message)

Automatically open gramchat and prompt the user with a message the moment the mouse fades out of the window.

```markup
<script>
MessageOnMouseLeave("Thanks for visiting our page! Bye");
</script>
```

## MessageOnHover(htmlID, message)

Automatically open gramchat and prompt the user with a message if he/she hovers over the given element

```markup
<div id="messageOnHoverDIV">Hover here</div>
<script>
MessageOnHover("messageOnHoverDIV", "You hovered over the div");
</script>
```

## MessageOnClick(htmlID, message)

Automatically open gramchat and prompt the user with a message if he/she clicks the given element

```markup
<div id="messageOnClickDIV">Click here</div>
<script>
MessageOnClick("messageOnClickDIV", "You clicked on the div");
</script>
```
