Welcome to the Smiirl Custom Counter official documentation 🥁
In case you missed it: this incredible piece of hardware can display any figure in real time! It's a great way to stay connected to the figures that matter most to you or your business.
The Counter can display data parsed into a JSON webpage or waits for external calls to update its number. It therefore requires a bit of technical know-how.
The objective of this repo is to help developers understand the ins and outs of connecting your data to a Custom Counter.
We feature explanations and real-life code for use cases with services such as YouTube or Facebook Ads; obviously free to use for your own application!
This doc assumes that you can host your code online. If not, you should follow this step-by-step tutorial for PHP by Heroku.
To get started, you may want to install the following packages. They help you transfer your data to the Counter with 1 line of code.
We have it in PHP: https://packagist.org/packages/smiirl/smiirl-library-php
And in JavaScript: https://www.npmjs.com/package/@smiirl/smiirl-library-js
You can install it in your Prestashop back office to display your sales data in real time. https://github.com/smiirl/prestashop-module
There are 2 ways to connect a number to a Smiirl Custom Counter:
JSON URL
PUSH NUMBER
.
For JSON URL
, the counter is active and will call an external url at regular time intervals
(chosen on the settings of the counter under REACTIVITY
).
For PUSH NUMBER
, the counter is passive and waits for external calls to update its number.
First choose the most adapted way for your application and follow the corresponding section.
The main configuration steps:
-
Configure your code file based on your project's specificity. Check out examples here:
JSON URL
. -
Host your code on your server under your own url "http://mycounterproject.mybusiness.com".
- Send a response with the 'Content-type'
application/json
- It should contain something like
{ "number": 42 }
- Send a response with the 'Content-type'
-
- Go to the Settings of your counter.
- Change its options to
JSON URL
. - Set the
url
with the one exposed in step 1. - If applicable, choose the attribute you want to show if your json has several ones.
- If applicable, customize the polling interval (reactivity).
- Save your settings.
- Go to the
Settings
of your counter. - Change its options to
"PUSH NUMBER"
. - Collect the
CURL Endpoint
of your counter; it should look likehttp://api.smiirl.com/YOU_MAC/set-number/YOUR_TOKEN/YOUR_NUMBER
. - Request this url in your code (
GET
). - Execute your code.
Click the sections below to review the code for simple and more real-life projects 🤓
You love the Counter and would like to contribute? Pull Requests welcome 😍
What other services would you like to see documented here? Please email us to partnership@smiirl.com. We would love to hear from you ❤️