Our JavaScript code is async and can't delay your website speed
Make sure to change the ACCOUNT ID for the base pixel
<script>'use strict'; (function (a, b, c) { if (!a.flashy) { a.flashy = function () { a.flashy.event && a.flashy.event(arguments), a.flashy.queue.push(arguments) }, a.flashy.queue = []; var d = document.getElementsByTagName('script')[0], e = document.createElement(b); e.src = c, e.async = !0, d.parentNode.insertBefore(e, d) } })(window, 'script', 'https://js.flashyapp.com/thunder.js'),flashy('init', __ACCOUNT_ID__); // Make sure to change the Account ID.</script>
Add this pixel only on a general pages, not product pages
<script>flashy('PageView');</script>
Add on product pages with the product ID
<script>flashy('ViewContent', {'content_ids': ["product_1"]});</script>
We recommend to use the UpdateCart to sync all the cart contents, when product removed from the cart or quantity changed or new product added
<script>flashy('UpdateCart', {'content_ids': ["product_id"],'value': 100,'currency': 'USD'});</script>
We suggest to use the UpdateCart instead of AddToCart
<script>flashy('AddToCart', {'content_ids': ["product_ids", "products_1"],'value': 100,'currency': 'USD'});</script>
Send the products ID's in array of strings: ["123", "456"]
To make sure order not being tracked more than once use the ORDER ID parameter
<script>flashy('Purchase', {'content_ids': ["product_id"],'value': 100,'currency': 'USD','order_id': '__ORDER_ID__'});</script>
Update purchase after status has been update - pending, delivered you can use any string and start automation based on the purchase status
<script>flashy('PurchaseUpdated', {'status': 'PENDING','order_id': '__ORDER_ID__','content_ids': ["product_id"], // Optional'value': 100, // Optional'currency': 'USD' // Optional});</script>
If you want to create & subscribe contacts from the front-end you can use this pixel or you can use our REST API and create the contact from the backend.
You can create contact and also subscribe him to a list, you need the LIST-ID to use that
<script>flashy.contacts.create({"email": "[email protected]","first_name": "John","last_name": "Doe",}, LIST-ID);</script>
Use this function to set the visitor email address, every action after (page views, add to cart), will be added to the contact profile
We automatically use this function when the URL has email parameter: https://websiteurl.com/[email protected]
<script>flashy('setCustomer', {"email": "[email protected]"});</script>
<script>flashy('CustomEvent', {"event_name": "SpecificAction"});</script>
Before you can update contacts from JS you need to make sure they are not anonymous.
<script>if( !flashy.contacts.anonymous() ){// Do anything you want...}</script>
Make sure the visitor on the website is not anonymous.
<script>flashy.contacts.update({"first_name": "Sam","anything": "You want"});</script>
Make sure you use Flashy global on ready only, we have event listen when it's ready and it's a best practice to wrap any function with it.
<script>window.addEventListener('onFlashy', function() {// Flashy global vriable ready to be used.// Use to Create / Update contacts from Flashy global variable});</script>
On Popup Show:
<script>window.addEventListener('flashyPopupShowed', ev => {console.log(ev.detail.popup_id);});</script>
If you want to show a popup based on custom event use the code below:
flashy('any-custom-even-you-want');