### Foresight is an analytics library that allows for declarative event tracking in your websites.
### Foresight is an analytics library that allows for declarative event tracking.
* Lightweight (<3kb minified and gzipped)
* Declarative event tracking
...
...
@@ -9,7 +9,7 @@
### Direct download
Download and install the latest distribution file from this
Git repository and load it in your webpage. For production cases, we encourage you to download the minified version ([`foresight.min.js`](#))
Git repository and load it in your webpage. For production cases, we encourage you to download the minified version ([`foresight.min.js`](blob/master/dist/foresight.min.js))
```html
<script src="/path/to/foresight.min.js"></script>
...
...
@@ -94,19 +94,19 @@ The above markup would send the following event data when the `div` enters the v
## Configuration
```ts
```js
{
/** Defer tracking initialisation. */
defer?:boolean
defer:false
/** Configure the intersection observer. */
observerOptions?:IntersectionObserverConfig
observerOptions:{/* Refer to Intersection Observer documentation */}
/** Treat clicks as an interactive event. Defaults to `true`. */
clicksAreInteractions?:boolean
clicksAreInteractions:true
/** Treat views as an interactive event. Defaults to `false`. */
viewsAreInteractions?:boolean
viewsAreInteractions:false
}
```
...
...
@@ -140,4 +140,16 @@ Parameters:
---
#### `send(data: EventData)`
Manually send an analytics event data.
Parameters:
*`data: EventData` An object containing the event data with the following keys: