text: /**
   * @fileoverview Request image ping.
   * 
   */
  
  'use strict';
  
  var forEachOwnProperties = require('../collection/forEachOwnProperties');
  
  /**
   * @module request
   */
  
  /**
   * Request image ping.
   * @param {String} url url for ping request
   * @param {Object} trackingInfo infos for make query string
   * @returns {HTMLElement}
   * @memberof module:request
   * @example
   * var imagePing = require('tui-code-snippet/request/imagePing'); // node, commonjs
   *
   * imagePing('https://www.google-analytics.com/collect', {
   *     v: 1,
   *     t: 'event',
   *     tid: 'trackingid',
   *     cid: 'cid',
   *     dp: 'dp',
   *     dh: 'dh'
   * });
   */
  function imagePing(url, trackingInfo) {
    var trackingElement = document.createElement('img');
    var queryString = '';
    forEachOwnProperties(trackingInfo, function(value, key) {
      queryString += '&' + key + '=' + value;
    });
    queryString = queryString.substring(1);
  
    trackingElement.src = url + '?' + queryString;
  
    trackingElement.style.display = 'none';
    document.body.appendChild(trackingElement);
    document.body.removeChild(trackingElement);
  
    return trackingElement;
  }
  
  module.exports = imagePing;
  