Integrating DealSpot outside of a SWF

DealSpot allows you to offer your customers virtual currency in exchange for completing advertiser offers. It intelligently matches customers to an exclusive set of targeted offers, such as flowers for Mothers Day, or tickets to newly released movies. DealSpot relies on a set of icons that rotate based on offers, and is smart enough to hide from customers if no offers are available.

Please note that before you can integrate DealSpot you must:

  • Sign up for a social merchant account at www.trialpay.com and
  • create a new, virtual currency product and campaign.

Code Snippet

Embed the following code snippet in a 100×100 container:

<span id="trialpay_dealspot"></span>

<script type="text/javascript" src="https://s-assets.tp-cdn.com/static3/js/api/payment_overlay.js"></script>

<script type="text/javascript">
  TRIALPAY.social.render_dealspot_swf(
    {
      "id" : "trialpay_dealspot",
      "mode" : "tpdirect",
      "vic" : "<vic>",
      "onOfferUnavailable" : "TRIALPAY.social.delete_dealspot_swf",
      "sid" : "<sid>"
    });
</script>

Required Parameters (case-sensitive):

Parameters Sample Value Description
vic ca09bfa71df887f038e155346ec1bb4b Your vendor integration code (supplied by your account manager).
onOfferUnavailable TRIALPAY.social.delete_dealspot_swf Collapses the DealSpot SWF if no offers are available. Can also call your own JavaScript function if there are no offers to show the customer. See “Offer Availability” below.
sid a4zoLFpPRGZx5Mqxp4r8LhrWEBs A unique alphanumeric ID that identifies the customer. Note: SID must not exceed 220 characters in length.r.

Optional Parameters (case-sensitive):

Parameters Sample Value Description
width 300 Overrides the DealSpot swf width (default is 100). Only do this if you are using custom icons. Your account manager can help you with this.
height 250 Overrides the DealSpot swf height (default is 100). Only do this if you are using custom icons. Your account manager can help you with this.
onTransact my_ontransact You can use this object to tell when a customer completes an offer. See “Offer Completions” below.
onOpen overlay_opened The name of your JavaScript function which DealSpot calls when a customer clicks the DealSpot touchpoint. See “Offer Overlay Opening/Closing” below.
onClose overlay_closed The name of your JavaScript function which DealSpot calls when a customer closes the offer details overlay. See “Offer Overlay Opening/Closing” below.
onOfferAvailable offer_available The name of your JavaScript function that we will call if there are one or more offers to show the customer. See “Offer Availability” below.

Listening for Events

Offer Completions

You can tell when a customer completes an advertiser’s offer by adding the following code (in green) to the code snippet:

<span id="trialpay_dealspot"></span>

<script type="text/javascript" src="https://s-assets.tp-cdn.com/static3/js/api/payment_overlay.js"></script>

<script type="text/javascript">
  function my_ontransact(obj) { alert('my_ontransact. completions: ' + obj.completions + ". vc_amount: " + obj.vc_amount); }

  TRIALPAY.social.render_dealspot_swf(
    {
      "id" : "trialpay_dealspot",
      "mode" : "tpdirect",
      "vic" : "<vic>",
      "onOfferUnavailable" : "TRIALPAY.social.delete_dealspot_swf",
      "sid" : "<sid>",
      "onTransact" : "my_ontransact"
    });
</script>

When a customer completes an offer, we’ll call the my_ontransact object and you can retrieve the number of completions (completions) and virtual currency reward amount (vc_amount) properties. Note that the completions will always be 0 or a positive integer. A 0 indicates that we timed out while waiting for a completion notification from the advertiser. In this case, we’ll also set vc_amount to 0.

Offer Overlay Opening/Closing

You can call your own function whenever a customer opens or closes the offer details overlay by including the onOpen or onClose parameters in the code snippet.

For example:

<span id="trialpay_dealspot"></span>

<script type="text/javascript" src="https://s-assets.tp-cdn.com/static3/js/api/payment_overlay.js"></script>

<script type="text/javascript">
  TRIALPAY.social.render_dealspot_swf(
    {
      "id" : "trialpay_dealspot",
      "mode" : "tpdirect",
      "vic" : "<vic>",
      "onOfferUnavailable" : "TRIALPAY.social.delete_dealspot_swf",
      "sid" : "<sid>",
      "onClose" : "overlay_closed"
    });
</script>

In the example above, whenever a customer closes the offer overlay, DealSpot will call a function named overlay_closed, which you have defined elsewhere in the frame/page.

Offer Availability

Before the DealSpot icon appears we check if there are any offers to show the customer. You can listen for the result and call your own functions by assigning the functions to the onOfferAvailable or onOfferUnavailable optional parameters. Note that if you call your own function when there are no offers available, your function should call TRIALPAY.social.delete_dealspot_swf at some point, or else you will see transparent whitespace in place of the SWF.

For example, let’s say you want to display an alternative promotion if there are no offers to show the customer. You create a function named alternative_promo, which you define somewhere in the DealSpot container, and assign it to the onOfferUnavailable optional parameter:

<span id="trialpay_dealspot"></span>

<script type="text/javascript" src="https://s-assets.tp-cdn.com/static3/js/api/payment_overlay.js"></script>

<script type="text/javascript">
  TRIALPAY.social.render_dealspot_swf(
    {
      "id" : "trialpay_dealspot",
      "mode" : "tpdirect",
      "vic" : "<vic>",
      "onOfferUnavailable" : "alternative_promo",
      "sid" : "<sid>"
    });

  function alternative_promo()
    {
      // code to show alternative promo
      TRIALPAY.social.delete_dealspot_swf(); // TrialPay's hide DealSpot function
    });

</script>

HTTP

If your game/app/page will be loaded over HTTP, you can load DealSpot over HTTP as well. This will provide a better user experience for your customers. To do this, update the code snippet’s src URL (in green) to point to our non-secure server:

<span id="trialpay_dealspot"></span>

<script type="text/javascript" src="http://assets.tp-cdn.com/static3/js/api/payment_overlay.js"></script>

<script type="text/javascript">
  TRIALPAY.social.render_dealspot_swf(
    {
      "id" : "trialpay_dealspot",
      "mode" : "tpdirect",
      "vic" : "<vic>",
      "onOfferUnavailable" : "TRIALPAY.social.delete_dealspot_swf",
      "sid" : "<sid>"
    });
</script>

Note: Publisher may not implement TrialPay’s services or technology on applications that are directed at, or collect data from, children under the age of 13.