Web AR callback event

Using Plattar, we allow you to link from your WebAR mobile experience back to a separate site or run a function on your main site.

To do this, you add either a url or a custom protocol to the link section of your plattar products/variations.

Alternately you can give the integration object the araction you want through code. integration.araction = 'Buy';

var integration = new PlattarIntegration();
integration.init(<product_id>, <variation_id>, ?callback);

integration.araction = 'Buy';

Adding a website url in this field will add a ‘View Online’ button to the WebAR experience on both Android and iOS and will take the user to that url when they click it.

Alternately you can add the custom protocol araction=X where X is the action you want in the callback. You can then add the following event listener that will be called when the user presses the button from their WebAR experience.

The product data will be sent through this event for you to implement whatever functionality you like, such as adding to cart or applying a discount coupon.

window.addEventListener('webarcallback', function(event){

  "source": "embed",
  "pageTitle": "",
  "pageURL": "https://example.com/?araction=Buy",
  "referrer": "",
  "applicationId": "<uuid>",
  "applicationTitle": "Example App",
  "sceneId": "<uuid>",",
  "sceneTitle": "Example Scene",
  "productId": "<uuid>",",
  "productTitle": "Example Product",
  "variationId": "<uuid>",
  "variationTitle": "Ring",
  "variationSKU": "SKU123"