- 02 Aug 2024
- 5 Minutes to read
- DarkLight
Standard Segment
- Updated on 02 Aug 2024
- 5 Minutes to read
- DarkLight
The Standard segment is a simple pixel and can be embedded on a web page. Each segment will have a different tag/pixel to implement.
Standard segments cannot receive any information from the website.
Create a standard segment
- In the left menu, click Data and select Segments.
You will then see the listings as below.
- In the upper right-hand corner, click +New Segment and select Standard Segment.
- Fill in out the following form and click Create to finish.
- Name: Enter a name for your segment.
- Expiry: Enter an expiry time for the retargeting. E.g.: if 15 days is selected, a user that has not been detected for a period of 15 days will no longer be included in the segment.
- Description: Enter a description of the segment.
Copy or Download a Standard pixel/tag
- On the segment row, click the three dots located in the Actions column:
- Select Copy Tag to copy the tag in your clipboard.
- Select Download Tag to download a .txt file containing the pixel/tag.
You can also download multiple pixels/tags in one .txt file by checking the checkbox of the segments you want and then clicking the Download Selected Tags button that just appeared at the top of the listing.
Implement a Standard tag
The Samsung DSP standard segment pixel can be placed directly on a web page on your website or in your tag manager.
Here's an example of a standard segment tag:
<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 DSP. 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 DSP. 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 DSP Simple Standard Segment 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 DSP 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's an example of an HTML page containing the pixel, called on page load event as well as on a button click event.
<!DOCTYPE html>
<html>
<head>
<title>Samsung DSP Universal Segment 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 DSP 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" />
View Segments Activity (Reporting)
- Click the three dots and select Segments under Reports or Real-Time section.