Link Converter

Existing content is your strength!

Overview

Your website is full of content users browse every day. Is there a way of effortlessly monetising your whole back catalog?

Yes, there is - Tradedoubler’s Link Converter!

Every link that belongs to an Advertiser you joined with Tradedoubler will be converted to an affiliate tracking link in a blink of an eye so you can earn commission from all your eligible content without hassle. All your existing advertiser links will be replaced so you don't need to change anything!

  • Converts every advertiser link on your behalf
  • Adds your EPI/EPI2 values automatically
  • Always uses up to date tracking
  • Easy “copy&paste” installation
  • Monetise your entire website in seconds
  • Any enhancements Tradedoubler will introduce will be rolled out automatically

The Conversions API enables you to work more efficiently by receiving transaction notifications in real-time rather than having to run static reports from an interface.


Do not have a publisher account? Register with Tradedoubler and get started today!

Simple Installation

If you are using one of the following CMS platforms we recommend you use official Tradedoubler plug-in. The plug-in includes ad-blocking prevention mechanism described on this page.

Otherwise, the following steps will help you integrating the Link Covnerter on your website in seconds.

  1. Sign in to your Tradedoubler Interface
  2. Navigate to Tools / Link Converter
  3. Select your website from the dropdown
  4. Copy the code
  5. Paste the code into Body or Head section of your website

There is no extra configuration required on your website. All future changes will be handled in your Tradedoubler Publisher Interface.

Now that you installed Link Converter on your website you don't need to worry about affiliate links anymore! You can focus on what's important for you and grow your website.

Note: If you would like to prevent ad-blocking scripts disrupting your ads/tracking links delivery and increase your revenue follow the instructions on How to Intergrate Tradedoubler Link Converter server-side below.

Prevent Ad Blocking

Now that you can automatically create tracking links on your website for eligible advertisers you might wonder "what’s the best way to serve ads in today’s ad-blocking world?"

Tradedoubler offers you a way to integrate it’s Link Converter server-side. This means no tradedoubler.com request that can be blocked, and the tracking links will be created for eligible advertisers in a way that cannot be disrupted.

In order to implement this functionality you can use Tradedoubler Link Converter plug-in for the following CMS:

Note: If you would like to see a plug-in developed for your CMS let us know!

If you’re not using any of them, you can still implement the following process yourself to synchronize the Link Converter script with your own server:

  • Get your TRADEDOUBLER_WEBSITE_ID
  • Select YOUR LOCAL PATH on your server where you would serve the Link Converter script from. (You can name the file however you like and change it any time if it gets blocked in the future)
  • Use your individual Link Converter URL to sync the script from Tradedoubler server to YOUR LOCAL PATH. The URL is: https://link.tradedoubler.com/lc?a(YOUR_TRADEDOUBLER_WEBSITE_ID)
  • Schedule the sync (for example using CRON) to perform regularly. We recommend the interval to be at most 5 minutes so the Link Converter is always updated on your server
  • Once the process is set up use the following script to execute your locally hosted Link Converter on your website
    <script type="text/javascript">				
    window.tdlcAsyncInit = function() {
    		tdlc_epi = {your_EPI_variable_name_or_value}; // OTPIONAL
    		tdlc_epi2 = {your_EPI2_variable_name_or_value}; // OPTIONAL
    		  
    		TDLinkConverter.init({tdlc_epi, tdlc_epi2}); 
    	};
    	var tdlc_1d43f5s_a = new Date(); tdlc_1d43f5s_a.setMinutes(0); tdlc_1d43f5s_a.setSeconds(0);
    	var tdlc_1d43f5s_seconds = parseInt(tdlc_1d43f5s_a.getTime() / 1000);
    	(function(d, s){
    		var js, fjs = d.getElementsByTagName(s)[0];
    		if (d.getElementById(id)) { return; }
    		js = d.createElement(s); js.id = tdlc_1d43f5s_seconds;
    		js.src ="YOUR LOCAL_PATH?rand(" + tdlc_1d43f5s_seconds + ")";
    		fjs.parentNode.insertBefore(js, fjs);
    	}(document, "script"));
    </script>
    	
    Note:
    tdlc_epi / tdlc_epi2 (optional) - provide extra information you would like to see in your reports here. Those parameters can be blank/empty strings or compeltely left out from the code if not used.

Feel free to use the following script examples to set up the process manually on your side.

Example Link Converter synchronization scripts

This section includes synchronization logic in various programming languages as well as a pseudo code version to explain what the code is doing.


Link Converter synchronization script pseudo code

BEGIN

    FUNCTION download_file(AFFILIATE_ID, LOCAL_PATH)
        // Step 1: Accept value of parameter named AFFILIATE_ID
        // Step 2: Accept value of parameter named LOCAL_PATH

        // Step 3: Create a parameter REMOTE_URL with value of "https://link.tradedoubler.com/lc?a(AFFILIATE_ID)"
        SET REMOTE_URL = "https://link.tradedoubler.com/lc?a(" + AFFILIATE_ID + ")"

        // Step 4: Download file from REMOTE_URL to LOCAL_PATH
        CALL download_from_url(REMOTE_URL, LOCAL_PATH)
    END FUNCTION

    FUNCTION download_from_url(url, path)
        // Implement the logic to download file from the given URL and save it to the given path
        OPEN connection to url
        READ data from url
        OPEN file at path for writing
        WRITE data to file at path
        CLOSE file
        CLOSE connection
    END FUNCTION

END

ASP Link Converter synchronization script

<%
Sub DownloadFile(AFFILIATE_ID, LOCAL_PATH)
	' Step 1: Accept value of parameter named AFFILIATE_ID
	' Step 2: Accept value of parameter named LOCAL_PATH

	' Step 3: Create a parameter REMOTE_URL with value of "https://clk.tradedoubler.com/lc?a(AFFILIATE_ID)"
	REMOTE_URL = "https://clk.tradedoubler.com/lc?a(" & AFFILIATE_ID & ")"

	' Step 4: Download file from REMOTE_URL to LOCAL_PATH
	Call DownloadFromUrl(REMOTE_URL, LOCAL_PATH)
End Sub

Sub DownloadFromUrl(url, path)
	Dim http, stream, fso, file, data

	' Create the XMLHTTP object to download the file
	Set http = Server.CreateObject("MSXML2.ServerXMLHTTP.6.0")
	http.open "GET", url, False
	http.send

	' Check if the request was successful
	If http.status = 200 Then
		' Get the response body
		data = http.responseBody

		' Create the FileSystemObject to write the file
		Set fso = Server.CreateObject("Scripting.FileSystemObject")
		
		' Create the file and write the data
		Set file = fso.CreateTextFile(path, True)
		file.Write data
		file.Close

		Response.Write "File downloaded successfully to " & path
	Else
		Response.Write "Error: Unable to download the file. Status code: " & http.status
	End If

	' Clean up
	Set http = Nothing
	Set fso = Nothing
End Sub

' Example usage
Dim AFFILIATE_ID, LOCAL_PATH
AFFILIATE_ID = Request.QueryString("AFFILIATE_ID")
LOCAL_PATH = Server.MapPath("downloaded_file")

If Not IsEmpty(AFFILIATE_ID) Then
	Call DownloadFile(AFFILIATE_ID, LOCAL_PATH)
Else
	Response.Write "Error: AFFILIATE_ID parameter is missing."
End If
%>

C# Link Converter synchronization script

using System;
using System.IO;
using System.Net;

class Program
{
	static void Main(string[] args)
	{
		// Example usage
		string AFFILIATE_ID = "your_affiliate_id";
		string LOCAL_PATH = @"C:\path\to\local\file";

		download_file(AFFILIATE_ID, LOCAL_PATH);
	}

	static void download_file(string AFFILIATE_ID, string LOCAL_PATH)
	{
		// Step 1: Accept value of parameter named AFFILIATE_ID
		// Step 2: Accept value of parameter named LOCAL_PATH

		// Step 3: Create a parameter REMOTE_URL with value of "https://clk.tradedoubler.com/lc?a(AFFILIATE_ID)"
		string REMOTE_URL = "https://link.tradedoubler.com/lc?a(" + AFFILIATE_ID + ")";

		// Step 4: Download file from REMOTE_URL to LOCAL_PATH
		download_from_url(REMOTE_URL, LOCAL_PATH);
	}

	static void download_from_url(string url, string path)
	{
		try
		{
			// Create a WebClient instance to download the file
			using (WebClient client = new WebClient())
			{
				// Download the file data from the URL
				byte[] data = client.DownloadData(url);

				// Write the file data to the specified local path
				File.WriteAllBytes(path, data);

				Console.WriteLine("File downloaded successfully to " + path);
			}
		}
		catch (Exception e)
		{
			Console.WriteLine("Error: " + e.Message);
		}
	}
}

JavaScript Link Converter synchronization script


const https = require('https');
const fs = require('fs');

function download_file(AFFILIATE_ID, LOCAL_PATH) {
	// Step 1: Accept value of parameter named AFFILIATE_ID
	// Step 2: Accept value of parameter named LOCAL_PATH

	// Step 3: Create a parameter REMOTE_URL with value of "https://link.tradedoubler.com/lc?a(AFFILIATE_ID)"
	const REMOTE_URL = `https://link.tradedoubler.com/lc?a(${AFFILIATE_ID})`;

	// Step 4: Download file from REMOTE_URL to LOCAL_PATH
	download_from_url(REMOTE_URL, LOCAL_PATH);
}

function download_from_url(url, path) {
	https.get(url, (response) => {
		if (response.statusCode !== 200) {
			console.error(`Failed to download file, status code: ${response.statusCode}`);
			return;
		}

		const file = fs.createWriteStream(path);
		response.pipe(file);

		file.on('finish', () => {
			file.close();
			console.log('File downloaded successfully to ' + path);
		});
	}).on('error', (err) => {
		console.error(`Error: ${err.message}`);
	});
}

// Example usage
const AFFILIATE_ID = 'your_affiliate_id';
const LOCAL_PATH = '/path/to/local/file';
download_file(AFFILIATE_ID, LOCAL_PATH);

JSP Link Converter synchronization script

<%@ page import="java.io.*, java.net.*" %>
<%
	// Function to download the file
	void downloadFile(String AFFILIATE_ID, String LOCAL_PATH) throws IOException {
		// Step 1: Accept value of parameter named AFFILIATE_ID
		// Step 2: Accept value of parameter named LOCAL_PATH

		// Step 3: Create a parameter REMOTE_URL with value of "https://link.tradedoubler.com/lc?a(AFFILIATE_ID)"
		String REMOTE_URL = "https://link.tradedoubler.com/lc?a(" + AFFILIATE_ID + ")";

		// Step 4: Download file from REMOTE_URL to LOCAL_PATH
		downloadFromUrl(REMOTE_URL, LOCAL_PATH);
	}

	// Function to download the file from the URL and save it to the local path
	void downloadFromUrl(String urlString, String localPath) throws IOException {
		InputStream inputStream = null;
		FileOutputStream outputStream = null;
		try {
			// Create URL object
			URL url = new URL(urlString);
			// Open connection to the URL
			HttpURLConnection connection = (HttpURLConnection) url.openConnection();
			// Check if response code is HTTP_OK (200)
			if (connection.getResponseCode() == HttpURLConnection.HTTP_OK) {
				// Get input stream from the connection
				inputStream = connection.getInputStream();
				// Create output stream to write to the local file
				outputStream = new FileOutputStream(localPath);
				
				// Buffer to hold data chunks
				byte[] buffer = new byte[4096];
				int bytesRead = -1;

				// Read from input stream and write to output stream
				while ((bytesRead = inputStream.read(buffer)) != -1) {
					outputStream.write(buffer, 0, bytesRead);
				}
				
				out.println("File downloaded successfully to " + localPath);
			} else {
				out.println("Error: Server returned response code " + connection.getResponseCode());
			}
		} catch (Exception e) {
			out.println("Error: " + e.getMessage());
		} finally {
			if (inputStream != null) {
				inputStream.close();
			}
			if (outputStream != null) {
				outputStream.close();
			}
		}
	}

	// Example usage
	String AFFILIATE_ID = request.getParameter("AFFILIATE_ID");
	String LOCAL_PATH = application.getRealPath("/") + "downloaded_file";
	downloadFile(AFFILIATE_ID, LOCAL_PATH);
%>

PHP Link Converter synchronization script

<?php

function download_file($AFFILIATE_ID, $LOCAL_PATH) {
	// Step 1: Accept value of parameter named AFFILIATE_ID
	// Step 2: Accept value of parameter named LOCAL_PATH

	// Step 3: Create a parameter REMOTE_URL with value of "https://link.tradedoubler.com/lc?a(AFFILIATE_ID)"
	$REMOTE_URL = "https://link.tradedoubler.com/lc?a(" . $AFFILIATE_ID . ")";

	// Step 4: Download file from REMOTE_URL to LOCAL_PATH
	download_from_url($REMOTE_URL, $LOCAL_PATH);
}

function download_from_url($url, $path) {
	// Implement the logic to download file from the given URL and save it to the given path

	// Using file_get_contents to read the data from the URL
	$data = file_get_contents($url);
	if ($data === FALSE) {
		die("Error: Unable to download the file from the URL");
	}

	// Using file_put_contents to write the data to the specified path
	$result = file_put_contents($path, $data);
	if ($result === FALSE) {
		die("Error: Unable to save the file to the specified path");
	}

	echo "File downloaded successfully to " . $path;
}

// Example usage
$AFFILIATE_ID = "your_affiliate_id";
$LOCAL_PATH = "/path/to/local/file";
download_file($AFFILIATE_ID, $LOCAL_PATH);

?>