Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/useflyyer/flyyer-ping

Script for analytics and pre-rendering Flayyer images simple as https://edge.flayyer.host/v2/pixel.gif
https://github.com/useflyyer/flyyer-ping

analytics flayyer image-generator javascript lerna open-graph react twitter-cards typescript

Last synced: 8 days ago
JSON representation

Script for analytics and pre-rendering Flayyer images simple as https://edge.flayyer.host/v2/pixel.gif

Awesome Lists containing this project

README

        

# Flayyer Ping

Monitor and pre-render [Flayyer URLs](https://flayyer.com?ref=github)

[![lerna](https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg)](https://lerna.js.org/)

## Concept

**This is very similar to Facebook Pixel.**

This lightweight script with zero dependencies reads the `` of your HTML and if it finds a Flayyer URL in the contents of `og:image` or `twitter:image` it will ping one of our Flayyer severs to pre-render them (if were not rendered before) and to track some information to measure the impact of those images.

The easiest way of using this script is via a `` tag at the end of the `<body>` element. Here is an example:

```html
<script async defer src="https://unpkg.com/@flayyer/ping-script/dist/ping.min.js">

```

So a fully-featured but also minimalist site using Flayyer should look like this:

```html

Example

Example


...



```

By using this script we are able to pre-render the image at `https://flayyer.host/v2/tenant/deck/template.jpeg?title=Example` and also keep track of outside visitors that may be interested in your link thanks to the preview we generated.

## Packages

Checkout the [/packages](./packages) directory, anyways here is the full list:

| Package | Github | NPM | Description |
|----------------------|-------------------------------------------------|------------------------------------------------------------------------|----------------------------------------------------------------------------------------|
| @flayyer/ping | [/packages/ping](./packages/ping) | [@flayyer/ping](https://npmjs.com/package/@flayyer/ping) | Base script logic. Every other package imports this. |
| @flayyer/ping-script | [/packages/ping-script](./packages/ping-script) | [@flayyer/ping-script](https://npmjs.com/package/@flayyer/ping-script) | Minified script for browsers (``) |
| @flayyer/ping-module | [/packages/ping-module](./packages/ping-module) | [@flayyer/ping-module](https://npmjs.com/package/@flayyer/ping-module) | CommonJS-like package so you can import it on project with Webpack, Rollup or similar. |
| @flayyer/ping-react | [/packages/ping-react](./packages/ping-react) | [@flayyer/ping-react](https://npmjs.com/package/@flayyer/ping-react) | React hook and component for React.js projects. |

## Flayyer URLs

The easiest way of generating Flayyer URLs and forget about dealing with encoding issues is by using [flayyer/flayyer-js](https://github.com/flayyer/flayyer-js).

```js
import Flayyer from "@flayyer/flayyer";

const flayyer = new Flayyer({
tenant: "tenant",
deck: "deck",
template: "template",
variables: {
title: "Hello world!",
},
});

// Use this image in your