Request and implement a pixel
  • 30 Sep 2024
  • 5 Minutes to read
  • Dark
    Light

Request and implement a pixel

  • Dark
    Light

Article summary

This page provides you with an overview of pixels and describes the process to request and implement a pixel.

Pixel recommendations and requirements

Pixels are highly recommended for Web traffic campaigns and are required for Web conversion campaigns.


Pixels are a short piece of code that is embedded on your website. When triggered, this code captures insights about the audiences engaging on your website so we can optimize audience targeting and track the actions they are taking in order to measure conversions.

Follow the instructions below to learn how to request and implement a pixel.

Request a pixel

Request a pixel when creating a web traffic or web conversion campaign:

  1. Log into Samsung Ad Manager.

  2. On the navigation ribbon at the top of the page, select Campaigns. The Campaigns listing page will be displayed.

  3. Click +Create Campaign. The new campaign page will be displayed.

  4. In the Name field, enter the name of your campaign.

  5. In the Goal section, select either a web traffic or web conversion campaign. The conversion measurement section will be displayed.

  6. Click the Pixel request toggle to the on position. Your Samsung representative will reach out to you to provide you with a new pixel or to confirm the details of an existing pixel to leverage in your campaign.

  7. Complete and submit the campaign form.


Implement a pixel

Samsung Ad Manager pixels can be placed directly on a web page on your website or in your tag manager.

Here is an example:

<img src="//rtb.adgrx.com/segments/XXXX/yyy.gif" width="1" height="1" border="0" />

Tag managers

Click here to expand

Tag Manager

Type

Implementation Notes

Google Tag Manager

Custom Image

URL without https. Ex://rtb.adgrx.com/segments/XXXX/yyy.gif

Google Tag Manager

Custom HTML

Paste the entire code provided by Samsung Ad Manager. Ex:<img src="//rtb.adgrx.com/segments/XXXX/yyy.gif" width="1" height="1" border="0"/>

Google Floodlight

Dynamic tag

Paste the entire code provided by Samsung Ad Manager. Ex:<img src="//rtb.adgrx.com/segments/XXXX/yyy.gif" width="1" height="1" border="0"/>

Complete HTML Page Example

Click here to expand

When placing the pixel directly into your web page HTML, it must be between <body>and </body> tags. It is recommended to place it near the bottom before the closing </body> tag.

Below is an example of a standard segment tag on a blank page:

<!DOCTYPE html>
    <html>
    <head>
      <title>Samsung Ad Manager Pixel Demo</title>
    </head>
    <body>

      ...content...

      <img src="//rtb.adgrx.com/segments/XXXX/yyy.gif" width="1" height="1" border="0" />
    </body>
    </html>

Advanced examples

JavaScript version

Click here to expand

In some cases, you might need to implement the pixel as JavaScript code. See the following example:

var __SAMSUNG_DSP_PIXEL = new Image();
__SAMSUNG_DSP_PIXEL.src = "//rtb.adgrx.com/segments/XXXX/yyy.gif";

Implementing the tag on a button

Click here to expand

While the best and more reliable way to call tags or pixels is directly on a page or via a tag manager, it is also possible to call our tag when the user clicks on a button. We highly recommend having the tag or pixel directly on the destination page of the button, but if it's not possible to implement a tag on the destination page, here are a few examples of how to call the tag or pixel on a button.

Without a redirect or redirect that opens a new tab/window

If clicking the button does not redirect the user to another page or open up a new tab or window (e.g., <a target="_blank">), the tag or pixel should be called correctly as there is enough time for the browser to execute the javascript and call Samsung Ad Manager servers.

<script>
function buttonSamsungDSPTracking() {
  var __SAMSUNG_DSP_PIXEL = new Image();
  __SAMSUNG_DSP_PIXEL.src = "//rtb.adgrx.com/segments/XXXX/yyy.gif";
}
</script>
<a href="https://www.customer.com/page123" target="_blank" onclick="buttonSamsungDSPTracking();">button</a>

With a redirect in the same tab/window

If the button redirects the user to another page that loads in the same tab/window, you need to prevent the default redirect temporarily to allow the tag/pixel/segment call to complete prior to the redirection.

Using this technique, there is no guarantee that the tag or pixel will be called correctly. This is because depending on the connection speed of the user, 1 second might not be enough to call the Samsung DSP server. You can change the timeout to a greater value, but there is still no guarantee the tag or pixel will have time to execute and complete.

<script>
function buttonSamsungDSPTracking(pLinkObj) {
  // Prevent the redirection
  evt.preventDefault ? evt.preventDefault() : (event.returnValue = false);

  var __SAMSUNG_DSP_PIXEL = new Image();
  __SAMSUNG_DSP_PIXEL.src = "//rtb.adgrx.com/segments/XXXX/yyy.gif";

  setTimeout("window.location.href ='" + pLinkObj.href + "'", 1000);
}
</script>
<a href="https://www.customer.com/page123" onclick="buttonSamsungDSPTracking(this); return false;">button</a>

Alternate code: Using an event listener instead of onclick attribute.

<a id="myButton" href="https://www.customer.com/page123">button</a>
<script>
// Cross-browsers event listener function
function regEvent(elem, eventName, fn) {
  if(typeof elem.addEventListener != "undefined") {
    elem.addEventListener(eventName, fn, false);
    return true;
  } else if(typeof elem.attachEvent != "undefined") {
    elem.attachEvent("on"+eventName, fn);
    return true;
  } else if(typeof elem["on"+eventName] == "function") {
    var existing = elem["on"+eventName];
    elem["on"+eventName] = function() {
      existing();
      fn();
    };
    return true;
  } else {
    try { elem["on"+eventName] = fn; } catch(err) { return false; }
    return typeof elem["on"+eventName] == "function";
  }
}

function buttonSamsungDSPTracking(evt, pLinkObj) {
  // Prevent the redirection
  evt.preventDefault ? evt.preventDefault() : (event.returnValue = false);

  var __SAMSUNG_DSP_PIXEL = new Image();
  __SAMSUNG_DSP_PIXEL.src = "//rtb.adgrx.com/segments/XXXX/yyy.gif";

  setTimeout("window.location.href ='" + pLinkObj.href + "'", 1000);
}
regEvent(document.querySelector("#myButton"), "click", function(evt) { buttonSamsungDSPTracking(evt, this); });
</script>

Implementing the tag on page load and a button

Click here to expand

Here is an example of an HTML page containing the pixel, called on the page load event as well as on a button click event:

<!DOCTYPE html>
<html>
<head>
  <title>Samsung Ad Manager Tag Demo</title>
  <script>
    // Cross-browsers event listener function
    function regEvent(elem, eventName, fn) {
      if(typeof elem.addEventListener != "undefined") {
        elem.addEventListener(eventName, fn, false);
        return true;
      } else if(typeof elem.attachEvent != "undefined") {
        elem.attachEvent("on"+eventName, fn);
        return true;
      } else if(typeof elem["on"+eventName] == "function") {
        var existing = elem["on"+eventName];
        elem["on"+eventName] = function() {
          existing();
          fn();
        };
        return true;
      } else {
        try { elem["on"+eventName] = fn; } catch(err) { return false; }
        return typeof elem["on"+eventName] == "function";
      }
    }
  </script>
</head>
<body>
  <button id="myButton">Click Me!</button>

  <!-- Called immediately -->
  <img src="//rtb.adgrx.com/segments/XXXX/yyy.gif" width="1" height="1" border="0" />

  <!-- Code that will enable the universal to be called again,
       with a different event_name when the button is clicked -->
  <script>
    function buttonSamsungDSPTracking() {
      var __SAMSUNG_DSP_PIXEL = new Image();
      __SAMSUNG_DSP_PIXEL.src = "//rtb.adgrx.com/segments/XXXX/yyy.gif";
    }

    // Here, we are using the regEvent function we have defined in the <head>, but you
    // can use your own function to setup the event listener (ex: jQuery.click)
    regEvent(document.querySelector("#myButton"), "click", buttonSamsungDSPTracking);
  </script>
</body>
</html>

Data Parameters

Revenue (conversion)

Optionally, it is possible to pass in the "revenue" generated from a conversion into the standard segment tag. This allows Samsung Ad Manager to report on conversion revenue.

To do so, simply add ?AG_REV= and the value of the conversion, as shown below.

<img src="//rtb.adgrx.com/segments/XXXX/yyy.gif?AG_REV=1.25" width="1" height="1" border="0" />


Was this article helpful?

What's Next
Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.