Skip to content

Yieldmo Advertiser SDK

Melody Li edited this page Sep 10, 2018 · 24 revisions

Yieldmo allows advertisers to track leads, intentions, and conversions. In order to do so, advertisers need their unique advertiser id.

Conversion calls can optionally send information with their calls. If advertisers would like to use conversion calls to mark or retarget Yieldmo users, refer to Using Conversion Data for Retargeting/Remarketing.

There are two ways to integrate conversion tracking:

  • Yieldmo Immediately-Invoked Function Expression(IIFE) Script (Basic Solution):
    Fire off a conversion tracking call by simply dropping your Yieldmo IIFE JavaScript tag into the head of the page. As soon as it is parsed by the browser, it will make a conversion call to Yieldmo's tracker.
  • Yieldmo SDK "track" method (Advanced Solution):
    Load the Yieldmo Advertiser SDK into your site and invoke the public tracking method at any given time. This is a great solution for single-page applications (SPA) or applying logic before tracking a conversion.

Getting Your Advertiser Id:

If you do not currently have access to your advertiser id, please contact our Operations team for more information.

Using Conversion Data for Retargeting/Remarketing

If you have retargeting turned on, and you would like to use the conversion call to mark or retarget users across the Yieldmo network, prefix all properties passed into the third array item discussed below with ym-. This will tell Yieldmo that you intend on having us retarget that user with that particular product you've sent back to us.

Name Description Example Required/Optional
ym-category The product or item category. 'shoes' Optional
ym-order-id The Order ID for the purchase. ‘5353556541’ Optional
ym-item-ids The ID of the item, which should match the product or service ID in a product feed. Can include multiple values, which should be delimited by a comma. ‘123123,125252’ or '412424' Optional
ym-order-total The total price of all items selected, including tax and shipping. '100' Optional
ym-currency The currency used by the user. 'USD' or 'CAN' Optional
ym-kw Keywords that a user entered while searching for a product 'mens shoes' Optional

Methods

Yieldmo IIFE

To track conversions on page load, use the following IIFE script:

<!-- BEGIN Yieldmo IIFE Conversion Script -->
<script>
  /* DO NOT MODIFY CODE BELOW */
  (function(){
    var __yms, __p;
    __p = document.body || document.head;
    __yms = document.createElement('script');
    __yms.async = true;
    __yms.src = '//static.yieldmo.com/ym.adv.min.js';
    __yms.className = 'ym-adv';
    if(__p && !window['___ym']) __p.appendChild(__yms);
  })();
     
  window['_ymq'] = window._ymq || [];
  /* DO NOT MODIFY CODE ABOVE */
  
  /**
   * You may modify the code below to to include custom fields that you 
   * (the advertiser) use in your business, please refer to the docs for more info.
   * 
   * NOTE: Notice how the block in the <noscript> area contains the same
   * params as in the line of code right below this comment.
   */
  window['_ymq'].push(['lead', '9876987698769876', {
    'price': '100.00',
    'currency': 'USD'
  }]);
     
</script>
<noscript>
  <img
      height="1"
      width="1"
      alt=""
      style="display:none"
      src="https://tkr.yieldmo.com/t_adt/adt?ymi=1&amp;conversion_type=lead&amp;ymadvid=9876987698769876&amp;price=100.00&amp;currency=USD&amp"
   />
</noscript>
<!-- END Yieldmo IIFE Conversion Script -->

Parameters in the .push call in the code above should be changed to suit your account's needs.

In the event that JavaScript is disabled or not allowed, update the <noscript> part to reflect what you'd like to be passed on to us. Note that the <noscript> portion is not required, but is there in case you need a plain HTTP request to mark a conversion.

The parameter being passed into the 'push' call is an array with three items:

  • The first item in the array is the conversion_type that Yieldmo will receive. This can read "sale", "transaction", "checkout", or anything that suits your business needs.

Note: Please ensure you communicate the conversion types you wish to track to your Yieldmo Account Manager or directly implement them as reportable conversions in Yieldmo Admin so these events are displayed in reports.

  • The second item in the array is the custom advertiser ID your Account Manager will provide you with.
  • The third item in the array is a simple object containing a key-value pair of added metadata. You may add in price, size, color, name, e-mail address, or anything else you'd like to track along with the conversion. Yieldmo will grab this data and hold on to it for you. Please be aware that this object can ONLY be a 1-level key/value pair of data. We currently do not support nesting other arrays or objects into the object.

Example Page. Please ensure you emulate a mobile device

"Track" Method, On-demand

This method is for clients who would like to track more than one event on the same page load or do not want to immediately invoke a conversion call.

This involves the following two steps:

  1. Include Yieldmo's advertiser SDK library by adding the following to your page: <script src="//static.yieldmo.com/ym.adv.min.js" async="true"></script>
  2. When your user converts or does a transaction that you'd like to track, simply call our "track" method, like so:
...
  window.___ym.track('lead', '9876987698769876', {
    'price': 150.00,
    'currency': 'USD'
  });
...

Just like the IIFE push method (Method 1), the parameters follow the same convention:

  • The first item [required] is the type of conversion ("sale", "lead", "interest")
  • The second item [required] is your Yieldmo Advertiser ID.
  • The third item [optional] is a key-value object of metadata that will be serialized and sent along with the tracked conversion.

Please Note: The window.___ym object has three underscores. You will need to access this object any time you you want to interact with the Yieldmo Advertiser API.

Example Page. Please ensure you emulate a mobile device

Clone this wiki locally