Our API protocol uses the REST format.
The REST Endpoint URL is: http://sourcedfrom.com/analytics/token-generatory.php
account (md5, your SourcedFrom Analytics username)
guid (url, the url of the entry you wish to track)
title (string, optional, the entries title)
description (string, optional, the entries description)
publisher (string, optional, the publishers name)
publisher_email (md5, optional, the publishers email, is required if publisher parameter is used)
http://sourcedfrom.com/analytics/token-generator.php?account=fe01ce2a7fbac8fafaed7c982a04e229&guid=http%3A%2F%2Fmysite.com%2Fentry-url-to-track%2F&title=Lorem+Ipsum&description=Lorem+ipsum+dolor+sit+amet%2C+consectetuer+adipiscing+elit.&publisher=Jane+Doe&
publisher_email=35f5782642e9fa0f6cfff5a552e2ae97
<?xml version='1.0' encoding='UTF-8'?> <sf_api_server_rsp status='ok' version='0.1'> <token_id>555ab4855r55e0x7796dd48c85553f4a</token_id> <token_url>http://sourcedfrom.com/analytics/token.png?
id=555ab4855r55e0x7796dd48c85553f4a</token_url> </sf_api_server_rsp>
<?xml version="1.0" encoding="UTF-8"?> <?robots index="no" follow="no"?> <sf_api_server_rsp status="fail" version="0.1"> <err code="177" msg="You do not have a SourcedFrom account." /> </sf_api_server_rsp>
<?php
/*
* SourcedFrom Analytics get entry token example.
*/
// Using the free SourcedFrom class.
require_once("SourcedFrom.class.php");
$sourcedfrom = new SourcedFrom;
$sourcedfrom->account = 'demo'; // SourcedFrom Analytics username
$sourcedfrom->guid = 'http://mysite.com/entry-url-to-track/';
$sourcedfrom->name_in_footer = 'John Doe'; // If using
token_footer_xhtml
// These are optional parameters:
$sourcedfrom->title = 'Lorem Ipsum';
$sourcedfrom->description = 'Lorem ipsum dolor sit amet,
consectetuer adipiscing elit.';
$sourcedfrom->publisher = 'Jane Doe';
$sourcedfrom->publisher_email = 'jane@doe.com';
if ( $sourcedfrom->request_analytics_token() ) {
// Successfully got token ID.
echo "token_id: " . $sourcedfrom->token_id . "\n";
echo "token_url: " . $sourcedfrom->token_url . "\n";
// Can insert this xhtml formatted footer in your entry.
echo $sourcedfrom->token_footer_xhtml;
} else {
// Failed, but still can use token_footer_xhtml.
echo "error_code: " . $sourcedfrom->error_code . "\n";
echo "error_message: " . $sourcedfrom->error_message . "\n";
// Can insert this xhtml formatted footer in your entry.
echo $sourcedfrom->token_footer_xhtml;
}
?>