Step 1: Add storefront.js to your website
Include Smile.io JavaScript on every page, typically this is added to the footer of your site.HTML
Step 2: Initialize storefront.js
Include asweettooth-init div on every page of your website. The data attributes in this div will be read and used to configure Smile.io’s JavaScript when it loads.
HTML
Initialization div properties
| Attribute | Description |
|---|---|
data-channel-api-key | Your Smile.io public key. This is used for identifying your store and can be made public. This can be found in your account settings. |
data-external-customer-id | The unique id of the currently logged in customer on your store. This should be the same id used when sending Events to the Smile.io API. This may be left blank if no customer is currently logged in. |
data-customer-auth-digest | The digest is a hashed value used to verify the request is actually coming from your store. To generate this value, see the instructions below. |
Auth digest generation
The customer digest is what’s used to verify your store is the one requesting information from Smile.io on behalf of a customer. It should be generated using your platform’s server side language so your Smile.io private key remains secret, using the SHA256 algorithm, and converted to hexadecimal. The customer id used should be theexternal_id sent in the Backend Integration Guide, and as the data-external-customer-id attribute in the initialization div.
Ruby
Step 3: Add the Smile.io Launcher to your website
The launcher displays a tab that lets customers engage with the rewards program.HTML