SDK Implementation

This is the preferred method for both parties as it offers the most robust tracking and customization on your end.

SDK Code Snippet

Snaps will provide you MYCODE, which you can use with the following code snippet and paste in your page's <head> tag. Your MYCODE will come from your contact at Snaps and is specific to your brand’s application on our platform. It will look something like this:

<script>
!function(e,n,t,s,i,r,a){e.sp=e._snapsPixel=function(){return e[s].q.push(arguments),e.sp},e[s].q=[],e[s].initialize=function(){return e[s]},e[s].trackEvent=e[s],r=n.createElement(t),a=n.getElementsByTagName(t)[0],r.async=1,r.src="https://pixel.snapsmedia.io/sp.js",a.parentNode.insertBefore(r,a)}(window,document,"script","_snapsPixel");

sp('create', 'MYCODE');
</script>

Event Tracking

If you’d like to track specific events, such as pageView, addToCart or completeOrder, you can do so by invoking the track method.

<script>
  sp('track', 'pageView', { price: 99.99});
  sp('track', 'addToCart', { price: 99.99 });
  sp('track', 'completeOrder', { price: 99.99});
</script>

All calls to the Snaps pixel require an event type (like addToCart) and a set of metadata about the event, which is passed in as an object. For example, when someone adds an item to the cart on your website, we ask that you include the product ID and other details to provide your users with the best experience.

Supported events include completeOrder, addToCart, and viewProduct. See Standard events for more details about required and optional metadata for each event type.