This task only need one simple POST request to ClickMeter’s APIs.
Usage:
$body = array(
'type' => 0,
'title' => "A friendly name",
'groupId' => $TL_campaign_id,
'name' => $custom_name,
'typeTL' => array(
'domainId' => $domainId,
'redirectType' => $redirectType,
'url' => $destination_url
)
);
$output = api_request('http://apiv2.clickmeter.com/datapoints', 'POST', json_encode($body) , $api_key);
Parameters:
This request needs a body to carry arguments, in JSON format. Here are showed the minimum number of parameters necessary to get a successful creation:
-
type: the type of datapoint to be created, 0 for tracking link, 1 for tracking pixel.
-
title: a friendly name to display the created tracking pixel into ClickMeter.
-
groupId: the identifier of the campaign that will contain the created tracking link. ks.
-
name: the custom name that will appear in the tracking link URI. For instance http://trk.as/example-custom-name
-
domainId: the identifier number of the domain used to create the tracking link. For instance, it will correspond to trk.as or 9nl.us or any other personal or dedicated domain created by the user (get it from /domains endpoint).
- redirectType: is an enum (allowed values are 301 or 307) it determines the response status code for the redirect
-
url: the destination URL which visitors will be redirected.
Return value:
The response body will contain the id of the created tracking link.
0 Comments