SlideShare una empresa de Scribd logo
1 de 17
Descargar para leer sin conexión
Adobe®
Marketing Cloud
Adobe Analytics Data Insertion API
Contents
Data Insertion API.............................................................................................................3
Overview...............................................................................................................................................................................3
Data Insertion Process...............................................................................................................................................................................3
Visitor Identification...................................................................................................................................................................................4
Sequential Data Requirements..............................................................................................................................................................5
Delayed Data.................................................................................................................................................................................................5
HTTP 1.1..........................................................................................................................................................................................................6
Limitations.....................................................................................................................................................................................................6
Reference..............................................................................................................................................................................6
Supported XML Tags and Query Variables........................................................................................................................................7
POST Response Codes.............................................................................................................................................................................10
Sample Code.....................................................................................................................................................................11
HTTP POST Sample...................................................................................................................................................................................11
HTTP GET Sample......................................................................................................................................................................................13
Data Insertion Sample (PHP).................................................................................................................................................................14
Data Insertion Sample (Java)................................................................................................................................................................15
Data Insertion Sample (Python)...........................................................................................................................................................17
Adobe Analytics Data Insertion APILast updated 9/24/2013
Data Insertion API
The Data Insertion API supports HTTP POST and HTTP GET for submitting data to Adobe Marketing Cloud servers.
Overview
The Data Insertion API provides a mechanism for server-side data collection and submission to Marketing Cloud servers.
Instead of using JavaScript beacons on each Web page to transmit visitor data to Online Marketing Suite servers, server-side
data collection collects data based solely on Web browser requests and Web server responses.
While this data capture method cannot capture all data that is available via page-based beacons, it provides valuable insight into
user activity on your Web pages without the overhead associated with attaching a JavaScript beacon to every Web page.
Data Insertion Process
The Data Insertion API supports HTTP POST and HTTP GET for submitting data to Adobe Marketing Cloud servers.
Note: The Analytics response to each data insertion includes a status message (SUCCESS or FAILURE).
HTTP POST
Use an HTTP POST to submit properly-formatted Data Insertion XML to the Data Insertion URL. The Data Insertion URL
differs from the standard JavaScript data submission URL. Adobe ClientCare can provide the domain name of the Adobe data
collection servers where you should send data. For example:
http://namespace.112.2o7.net/b/ss//6
http://namespace.122.2o7.net/b/ss//6
Note: The "6" code at the end of the URL indicates that the data submission requires XML processing.
Upon receipt, Adobe servers perform basic tag validation of the data insertion. If it encounters an error, Adobe returns a Failure
response. If the data insertion is successful, Adobe queues the data insertion request for processing by the standard Analytics
Data Processing Engine. The engine processes these requests in the same way it processes data collected via JavaScript.
When using HTTP POST with the Data Insertion API, consider the following:
• The Data Insertion API requires data in UTF-8 format. Specify the character encoding in the opening XML tag, as shown in
XML Data Insertion Format.
• Replace Ampersand (&), greater-than (>), and less-than (<) symbols with their HTML equivalents when passing them into a
Analytics variable. For example, submit <evar1>News & Sports <local> </evar1> as <evar1>News &amp; Sports
&lt;local&gt; </evar1>.
• To submit data over an encrypted connection, the application must be configured to support HTTPS POST commands. Some
tools that let you do this include:
• PHP versions 4.3.0 and higher support OpenSSL, and can be used to POST data through SSL port 443. You can see an example
of this in Sample Data Insertion (PHP).
• You can use cURL to send data over an SSL connection. For information about HTTPS POST in Java, see
http://java.sun.com/developer/technicalArticles/Security/secureinternet/.
3Data Insertion API
• Microsoft .Net Framework version 1.1 supports the HTTP header: Expect: 100-Continue in HTTP POST requests,
but Marketing Cloud servers reject POST data sent with this type of request. To avoid this, set
ServicePointManager.Expect100Continue = False. For more information, see
http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemnetservicepointmanagerclassexpect100continuetopic.asp .
HTTP GET
Use an HTTP GET to submit data to the Data Insertion URL in a query-string format that supports shortened variable names
(for more information, see "Variables and Query String Parameters" in the Analytics Implementation Guide, available at Help
> Documentation in the Marketing Cloud.
HTTP GET reduces bandwidth needs by 30% - 40%, but Adobe data collection servers do not send response messages, so if the
data insertion doesn't work as expected, you do not have that feedback for troubleshooting purposes. For more information,
see the HTTP GET Sample.
The Data Insertion URL differs from the standard JavaScript data submission URL. The <rsid> in the URL is the report suite
where you want to submit the data. Adobe ClientCare can provide the domain name of the Adobe data collection servers where
you should send data. For example:
http://namespace.112.2o7.net/b/ss/<rsid>/0
http://namespace.122.2o7.net/b/ss/<rsid>/0
Note: The "0" code at the end of the URL indicates that the data submission requires JavaScript processing. For example:
Upon receipt, Adobe servers perform basic tag validation of the data insertion. If it encounters an error, Adobe returns a Failure
response. If the data insertion is successful, Adobe queues the data insertion request for processing by the standard Analytics
Data Processing Engine. The engine processes these requests in the same way it processes data collected via JavaScript.
Note: The Data Insertion API requires data in UTF-8 format.
Visitor Identification
To track site visitors, each visitor must have a unique visitor ID. Ideally, this is a persistent cookie with an extended expiration
period (5 years or more.)
Use the visitorID tag, the combination of IP address and userAgent, to submit visitor ID information to Adobe data
collection servers. The visitorID variable supports up to 100 alpha-numeric characters and cannot contain a hyphen.
If the data insertion includes a visitorID, the Analytics Data Processing Engine assumes that persistent cookies are enabled
for the visitor's Web browser. If the data insertion identifies visitors using IP address/User Agent, Analytics displays persistent
cookies for that visitor as disabled.
Note: To avoid processing problems, make sure that visitorID is a uniformly distributed random number.
The visitorID is critical for linking a visitor's activities captured via JavaScript with those submitted through tagless data
collection, or a third-party application. For example, to link a visitor's browsing activity with transactions in a third-party
shopping cart application, you must pass the visitorID to the shopping cart application. The shopping cart application uses
the visitorID when uploading transaction data via the Data Insertion API so Analytics can link the transaction data to the
visitor's browsing activity (previously captured via JavaScript).
4Data Insertion API
Typically, the client systems generate unique visitor identifiers that you can use as the visitorID value. We recommend
generating your own visitor id, in both the XML and in the JavaScript so that the values match.
Sequential Data Requirements
To ensure accurate visitor pathing and commerce data, applications must send visitor data in the order it was received.
The Analytics Data Processing Engine closes a visit after 30 minutes without receiving data.
When simulating previously recorded traffic, Adobe recommends that data insertions mimic the time delays between visitor
events on the site. For example, if the application records page views for a given visitor 2, 4, and 5 seconds apart, send those
page views to Analytics using the same cadence.
If the application cannot mimic the original event timing, Adobe recommends sending sequential data insertions 3 seconds
apart, per visitor, to help avoid out-of-order data processing.
Delayed Data
By using the Data Insertion API, you can submit delayed data (for example, from an offline application, to Adobe data collection
servers.
Note: Data from delayed submissions is available to Data Warehouse and Ad hoc analysis.
When submitting delayed data, you must send visitor data in the order it was received, (see Sequential Data Requirements) but
you do not need to send data for different visitors in any specific order. For example, you can submit all data for visitor A before
data for visitor B, even if some or all of visitor B data occurred before visitor A data.
Submitting delayed data requires an additional <timestamp> tag in the XML. Analytics discards data without a timestamp.
Note:
To view time-stamped hits, Adobe ClientCare must enable time-stamp support on the report suite, in addition to the
time-stamp variable that you set. Time-stamped hits sent to a report suite that has not been enabled do not appear in the
report.
Format the timestamp data, including time zone, using either the Unix timestamp format or the ISO-8601 format. For example,
using the ISO-8601 format, a timestamp for a visitor event that occurred on November 17, 2009 at 5:33 PM Mountain Time
(GMT-7:00:00) is as follows:
2009-11-17T17:33:22-07
Consider the following when submitting delayed (time-stamped) data:
• While a report suite is collecting time-stamped data, it cannot collect data through the standard JavaScript beacon method.
• You must enable time stamp support on a per-report-suite basis.
• When submitting data delayed by more than 30 minutes, do so without any pauses in the data transmission to make sure
Analytics processes it as a single visit. Analytics might process delayed data as separate visits if there is more than a 100-second
pause between transmission batches.
• You can also use Data Sources to send this type of data to the Marketing Cloud via FTP. For more information, see the Data
Sources User Guide.
5Data Insertion API
HTTP 1.1
Adobe data collection servers support HTTP 1.1.
Using HTTP 1.1, you can send multiple POST requests in a single session. However, when using HTTP 1.1, be aware of the
following:
• While a report suite is collecting time-stamped data, it cannot collect data through the standard JavaScript beacon method.
• Adobe data collection servers limit the number of HTTP requests per HTTP session. To account for this, make sure your
application can detect closed sessions and respond appropriately.
• Adobe data collection servers observe HTTP 1.1 rules when chunking content. Make sure your application properly interprets
the chunking numbers provided in the Online Marketing Suite server response to your data insertion. For example, in the
following HTTP 1.1 response, the numbers 68 and 0 are chunking numbers, which represent the number of bytes to read
before the next chunk.
TTP/1.1 200 OK Date: Thu, 07 Dec 2008 15:48:51 GMT Expires: Wed, 06 Dec 2008 15:48:51 GMT
Last-Modified: Fri, 08 Dec 2008 15:48:51 GMT Cache-Control: no-cache, no-store, must-revalidate,
max-age=0, proxy-revalidate, no-transform, private Pragma: no-cache ETag:
"457837E3-649A-4BBB9314" Vary: * P3P: policyref="/w3c/p3p.xml", CP="NOI DSP COR NID PSA OUR
IND COM NAV STA" Transfer-Encoding: chunked Content-Type: text/xml 68 <?xml version="1.0"
encoding="UTF-8"?> <status>FAILURE</status> <reason>NO pagename OR pageurl</reason> 0
Limitations
There are some limitations to server-side data collection when compared to client-side data collection using JavaScript.
• Server-side data collection cannot collect Web browser configuration data.
• Server-side data collection cannot collect ClickMap data.
• Server-side data collection loses cached page navigation data because using a Web browser's back button or reloading a cached
page does not generate additional server requests or responses. This limits pathing data available for Analytics reports.
• Typically, bots do not run JavaScript when requesting a page, and do not request the page's image tags. However, server-side
data collection includes requests from bots and spiders.
• You must have control over the servers from which you want to collect data. If you use a Content Delivery Network (CDN)
such as Akamai* to deliver web pages, the server-side data collection described here cannot collect data for those pages.
• If you control most of your Web site pages, but use some third-party services (for example, surveys or shopping cart systems),
server-side data collection cannot collect data from the third-party pages. You should use JavaScript tagging on third-party
pages that request content from your Web servers to gain visibility into those systems.
• Server-side data collection alone cannot provide cross-domain tracking of site visitors. However, you can use the <visitorID>
tag in conjunction with client-side JavaScript data collection to pass additional information to the server. This is the only way
that cross-domain tracking is possible when using a <visitorID>.
• Server-side data collection can co-exist with a client-side (JavaScript) implementation only if clients submit server-side data
in near real-time. If clients have a JavaScript beacon implementation, and want to collect server-side data and submit it in
batches, they should use Data Sources, not the Data Insertion API.
Reference
Data insertion API reference topics.
This section contains details on supported XML tags and POST response codes.
6Data Insertion API
Supported XML Tags and Query Variables
When processing HTTP POST data submissions, only values in supported XML tags are processed. When submitting HTTP
GET data submissions, only specified query string and HTTP header variables are processed.
The following table lists all supported XML tags, along with their associated query string variable equivalents and HTTP header
variable equivalents, where applicable. The JavaScript variable column is provided for reference.
Every data insertion must include either <pageName> and/or <pageURL>.
Every data insertion must also include either <visitorID> and/or <IPaddress>.
Description
HTTP Header
Var
JavaScript
Variable
Query String Parameter
(GET)
XML Tag (POST)
Browser height in pixels (For
example, 768).
N/AN/A
bh<browserHeight>
Browser width in pixels (For
example, 1024).
N/AN/A
bw<browserWidth>
The campaign tracking code
associated with the page.
N/Acampaign
v0<campaign>
The page title or bread crumb.N/Achannel
ch<channel>
Monitor color depth in bits (For
example, 24).
N/AN/A
c<colorDepth>
Visitor's connection type ("lan" or
"modem").
N/AN/A
ct<connectionType>
Key-values pairs are specified in one
of the following formats:
N/AcontextData
c.[key]<contextData>
<my.a>red</my.a>
or:
<my><a>red</a></my>
Each of these examples result in a
context data value of my.a = red.
Multiple key-value pairs can be
specified.
In the query string, this context data
variable would appear as
c.my.a=red
7Data Insertion API
Description
HTTP Header
Var
JavaScript
Variable
Query String Parameter
(GET)
XML Tag (POST)
Whether the visitor supports first
party session cookies (Y or N).
N/AN/A
k<cookiesEnabled>
Revenue currency code For
example, USD.
N/AcurrencyCode
cc<currencyCode>
Analytics eVar.N/AeVar1 - eVar75
v#
For example, v2.
<eVar#>
For example,
<eVar2>.
A list of Analytics events.N/Aevents
events<events>
A hierarchy string.N/Ahier1 - hier5
h#
For example, h2
<hiern>
For example,
<hier2>.
Whether the current page is the
visitor's homepage (Y or N).
N/AN/A
hp<homePage>
The visitor's IP address.X-Forwarded-ForN/AN/A
<ipaddress>
Whether the visitor has Java enabled
(Y or N).
N/AN/A
v<javaEnabled>
JavaScript version. For example, 1.3.N/AN/A
j<javaScriptVersion>
The browser's supported language.
For example, "en-us".
Accept-LanguageN/A
N/A<language>
Name of link.N/AlinkName
pev2<linkName>
Type of link ("d", "e", or "o").N/AlinkType
pe<linkType>
The link's HREF. For custom links,
page values are ignored.
N/AlinkURL
pev1<linkURL>
A delimited list of values that are
passed into a variable, then reported
N/Alist1 - list3
l#<listn>
For example,
<list2>. as individual line items for
reporting.
The Web page name.N/ApageName
pageName<pageName>
8Data Insertion API
Description
HTTP Header
Var
JavaScript
Variable
Query String Parameter
(GET)
XML Tag (POST)
The Web page type. This is only
used on 404 error pages. Set
N/ApageType
pageType<pageType>
pageType to "Error Page" for when
a 404 error is detected.
The Web page URL For example,
http://www.mysite.com/index.html.
N/ApageURL
g<pageURL>
Semicolon separated list of Netscape
plug-in names.
N/AN/A
p<plugins>
List of all products on the page.
Separate products with a comma.
N/Aproducts
products<products>
For example: Sports;Ball;1;5.95,
Toys; Top;1:1.99.
Analytics property name.N/Aprop1 - prop75
c#
For example, c2
<propn> Forexample,
<prop2>
Purchase ID number.N/ApurchaseID
purchaseID<purchaseID>
The URL of the page referrer.N/AN/A
r<referrer>
Specifies the report suites where you
want to submit data. Separate
N/As_account
Contained in the URL. See
HTTP GET Sample.
<reportSuiteID>
multiple report suite IDs with a
comma.
Monitor resolution For example,
1280x1024.
N/AN/A
s<resolution>
Analytics XML request version
number. For example, 1.0.
N/AN/AN/A
<scXmlVer>
The Web server serving the page.N/Aserver
server<server>
The visitor's U.S. state.N/Astate
state<state>
The time and date on which the
data was collected.
N/Atimestamp
ts<timestamp>
9Data Insertion API
Description
HTTP Header
Var
JavaScript
Variable
Query String Parameter
(GET)
XML Tag (POST)
XML POST: Visitor's time zone
offset from GMT in hours. For
example, -8.
N/AN/APart of the t parameter
<timezone>
GET: The visitor's time zone is
included in the t query string
parameter, which contains the local
time. The t parameter is in the
following format:
dd/mm/yyyy hh:mm:ss D
OFFSET
Where D is a number in the range
0-6 specifying the day of the week,
and OFFSET represents:
offset from GMT in hours *
60 * - 1
For example:
09/23/2013 14:00:00 1 420
Common value used to tie
multi-channel user activities
N/AtransactionID
xact<transactionID>
together for reporting purposes. For
more information, see the Data
Sources User Guide.
The visitor's browser type and OS.User-AgentN/AN/A
<userAgent>
Visitor's unique identifying cookie.
See "Visitor Information" in
N/AN/A
vid<visitorID>
"Understanding the Data Insertion
API".
The visitor's zip code.N/Azip
zip<zip>
POST Response Codes
The Data Insertion API supports these response messages to HTTP POST operations.
The following table lists all supported XML tags, along with their associated JavaScript variable equivalents and HTTP header
variable equivalents, where applicable.
ponse messages can help you understand and correct the problem.
10Data Insertion API
DescriptionPOST Response
Success (general)
<?xml version="1.0" encoding="UTF-8"?><?xml version="1.0"
encoding="UTF-8"?><status>SUCCESS</status>
Failure (general)
<?xml version="1.0" encoding="UTF-8"?><?xml version="1.0"
encoding="UTF-8"?><status>FAILURE</status>
Failure (missing required report suite id)
<?xml version="1.0" encoding="UTF-8"?><?xml version="1.0"
encoding="UTF-8"?><status>FAILURE</status> <reason>NO
account</reason>
Failure (missing required page name or
page URL)
<?xml version="1.0" encoding="UTF-8"?><?xml version="1.0"
encoding="UTF-8"?><status>FAILURE</status> <reason>NO pagename
OR pageurl</reason>
Failure (missing required visitor id or IP
address)
<?xml version="1.0" encoding="UTF-8"?><?xml version="1.0"
encoding="UTF-8"?><status>FAILURE</status> <reason>NO
visitorid OR ipaddress</reason>
Failure (syntax error: includes malformed
XML, non-encoded reserved characters,
etc.)
<?xml version="1.0" encoding="UTF-8"?><?xml version="1.0"
encoding="UTF-8"?><status>FAILURE</status> <reason>Syntax
Error</reason>
Sample Code
The Data Insertion API includes these code samples.
Note: Do not copy-and-paste these code samples. They use generic values that you must replace with valid data appropriate
to your application.
HTTP POST Sample
This sample displays the structure of an HTTP POST request and response using the Data Insertion API.
Note: Do not copy-and-paste these code samples. They use generic values that you must replace with valid data appropriate
to your application.
The [rsid] parameter identifies the report suite where you want to submit the data. Other values, such as PageURL, are sample
values only.
HTTP 1.0 POST Request
POST /b/ss//6 HTTP/1.0
Host: [rsid].112.2o7.net
Content-Length: 593
<?xml version=1.0 encoding=UTF-8?>
<request>
<sc_xml_ver>1.0</sc_xml_ver>
<pageURL>apps.sillystring.com/summary.do</pageURL>
<referrer>http://apps.sillystring.com/summary.do</referrer>
<ipAddress>192.168.10.1</ipAddress>
<pageName>summary</pageName>
<eVar2>14911</eVar2>
11Data Insertion API
<userAgent>Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727;
Media Center PC 5.0; .NET CLR 3.0.04506)</userAgent>
<prop10>Brazil</prop10>
<visitorID>1286556420966514130</visitorID>
<timestamp>2009-03-05T01:00:01-05</timestamp>
<reportSuiteID>[rsid]</reportSuiteID>
</request>
HTTP POST Response
HTTP/1.1 200 OK
Date: Wed, 13 May 2009 16:26:47 GMT
X-C: ms-3.7.2
Expires: Tue, 12 May 2009 16:26:47 GMT
Last-Modified: Thu, 14 May 2009 16:26:47 GMT
Cache-Control: no-cache, no-store, must-revalidate, max-age=0, proxy-revalidate, no-transform,
private
Pragma: no-cache
ETag: "4A0AF4C7-08E1-37C7F492"
Vary: *
P3P: policyref="/w3c/p3p.xml", CP="NOI DSP COR NID PSA OUR IND COM NAV STA"
xserver: www79
Connection: close
Content-Type: text/xml
<?xml version="1.0" encoding="UTF-8"?>
<status>SUCCESS</status>
HTTP 1.1 POST Request
POST /b/ss//6 HTTP/1.1
Host: [rsid].112.2o7.net
Keep-Alive: timeout=15
Connection: Keep-Alive
Content-Length: 593
<?xml version=1.0 encoding=UTF-8?>
<request>
<sc_xml_ver>1.0</sc_xml_ver>
<pageURL>apps.sillystring.com/summary.do</pageURL>
<referrer>http://apps.sillystring.com/summary.do</referrer>
<ipAddress>192.168.10.1</ipAddress>
<pageName>summary</pageName>
<eVar2>14911</eVar2>
<userAgent>Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727;
Media Center PC 5.0; .NET CLR 3.0.04506)</userAgent>
<prop10>Brazil</prop10>
<visitorID>1286556420966514130</visitorID>
<timestamp>2009-03-05T01:00:01-05</timestamp>
<reportSuiteID>[rsid]</reportSuiteID>
</request>
HTTP 1.1 POST Response
HTTP/1.1 200 OK
Date: Wed, 13 May 2009 16:25:12 GMT
X-C: ms-3.7.2
Expires: Tue, 12 May 2009 16:25:12 GMT
Last-Modified: Thu, 14 May 2009 16:25:12 GMT
Cache-Control: no-cache, no-store, must-revalidate, max-age=0, proxy-revalidate, no-transform,
private
Pragma: no-cache
ETag: "4A0AF468-4DF2-33AE9089"
Vary: *
P3P: policyref="/w3c/p3p.xml", CP="NOI DSP COR NID PSA OUR IND COM NAV STA"
xserver: www116
Keep-Alive: timeout=15
Connection: Keep-Alive
Content-Length: 40
Content-Type: text/xml
12Data Insertion API
<?xml version="1.0" encoding="UTF-8"?>
<status>SUCCESS</status>
HTTP GET Sample
This sample displays the structure of an HTTP GET request and response using the Data Insertion API.
The [rsid] parameter identifies the report suite where you want to submit the data. Other values, such as PageURL, are sample
values only.
Note: Do not copy-and-paste these code samples. They use generic values that you must replace with valid data appropriate
to your application.
HTTP 1.0 GET Request
GET /b/ss/[rsid]/0?g=apps.sillystring.com%2Fsummary.do&r=http%3A%2F%2Fapps.sillystring.com%
2Fsummary.do&ip=192.168.10.1&gn=
summary&v2=14911&c10=Brazil&vid=1286556420966514130&ts=2009-03-05T01%3A00%3A01-05 HTTP/1.0
Host: [rsid].112.2o7.net
X-Forwarded-For: 192.168.10.1
HTTP 1.0 GET Response
HTTP/1.0 200 OK
Date: Wed, 13 May 2009 16:26:47 GMT
X-C: ms-3.7.2
Expires: Tue, 12 May 2009 16:26:47 GMT
Last-Modified: Thu, 14 May 2009 16:26:47 GMT
Cache-Control: no-cache, no-store, must-revalidate, max-age=0, proxy-revalidate, no-transform,
private
Pragma: no-cache
ETag: "49F5FD79-3E44-38021808"
Vary: *
P3P: policyref="/w3c/p3p.xml", CP="NOI DSP COR NID PSA OUR IND COM NAV STA"
xserver: www83
Connection: close
Content-Type: text/html
HTTP 1.1 GET Request
GET /b/ss/[rsid]/0?g=apps.sillystring.com%2Fsummary.do&r=http%3A%2F%2Fapps.sillystring.com%
2Fsummary.do&ip=192.168.10.1&gn=summary&v2=14911&c10=Brazil&vid=1286556420966514130&ts=2009-03-05T01%3A00%3A01-05
HTTP/1.1
Host: [rsid].112.2o7.net
Keep-Alive: timeout=15
Connection: Keep-Alive
X-Forwarded-For: 192.168.10.1
HTTP 1.1 GET Response
HTTP/1.1 200 OK
Date: Mon, 19 Oct 2009 17:26:24 GMT
Server: Omniture DC/2.0.0
X-C: ms-4.1.3
Expires: Thu, 01 Jan 1970 00:20:55 GMT
Last-Modified: Thu, 01 Jan 1970 00:20:56 GMT
Cache-Control: no-cache, no-store, must-revalidate, max-age=0, proxy-revalidate, no-transform,
private
Pragma: no-cache
ETag: "4ADCA140-6E16-1FADA4C7"
Vary: *
P3P: policyref="/w3c/p3p.xml", CP="NOI DSP COR NID PSA OUR IND COM NAV STA"
xserver: www176
Content-Length: 43
13Data Insertion API
Keep-Alive: timeout=15
Connection: Keep-Alive
Content-Type: image/gif
Data Insertion Sample (PHP)
This PHP sample illustrates how to connect to Adobe data collection servers and record a page view.
<?/
**
* @file
* Example code to send one pageview to Omniture via the Data Insertion API
* and check for a valid response.
*
* @author Omniture, an Adobe Company <clientcare@omniture.com>
* @copyright 2007-2010 Adobe Systems, Inc. All Rights Reserved.
*/
// NOTE: Contact an ClientCare to identify the correct namespace and domain for your company.
$namespace = "namespace";
$domain = "112.2o7.net";
$host = $namespace.".".$domain;
$rsid = "rsid";
$vid = "";
$ip = "10.0.0.1";
$page_url = "";
$pageName = "Test Page";
$timestamp = "2008-10-21T17:33:22-07";
// create opening XML tags
$xml = "<?xml version=1.0 encoding=UTF-8?>n";
$xml .= "<request>n";
$xml .= " <scXmlVer>1.0</scXmlVer>n";
// add tags for required elements
$xml .= $rsid ? " <reportSuiteID>$rsid</reportSuiteID>n":"";
//The timestamp line of code can only be used when an Omniture representitive has enabled
timestamp support for your organization.
$xml .= $timestamp ? " <timestamp>$timestamp</timestamp>n":"";
$xml .= $vid ? " <visitorID>$vid</visitorID>n":"";
$xml .= $ip ? " <ipAddress>$ip</ipAddress>n":"";
$xml .= $page_url ? " <pageURL>$page_url</pageURL>n":"";
$xml .= $pageName ? " <pageName>$pageName</pageName>n":"";
// close the XML request
$xml .= "</request>n";
// Create POST, Host and Content-Length headers
$head = "POST /b/ss//6 HTTP/1.0n";
$head .= "Host: $hostn";
$head .= "Content-Length: ".(string)strlen($xml)."nn";
// combine the head and XML
$request = $head.$xml;
$fp=fsockopen($host,80,$errno,$errstr,30);
// Use this function in place of the call above if you have PHP 4.3.0 or
// higher and have compiled OpenSSL into the build.
//
// $fp = pfsockopen("ssl://".$host, 443, $errno, $errstr);
//
if( $fp ) {
// send data
fwrite($fp,$request);
14Data Insertion API
// get response
$response="";
while( !feof($fp) ){
$response .= fgets($fp,1028);
}
fclose($fp);
// display results
echo "RESULTS:n";
print_r($response);
echo "n";
// check for errors
if( preg_match("/status>FAILURE</status/im",$response) ){
/*
* TODO:
* write $request and $response to log file for investigation
* and retries
*/
echo "<h1>Failure</h1>n";
echo "<p>Note the reason tag in the response, fix and try again.</h1>n";
}
} else {
echo "<H1>Couldn't open port to Analytics servers</H1>n";
if(!$rsid){
echo "<H4>No report suite specified</H4>n";
} else {
echo "<p>$errstr ($errno)</p>n";
/*
* TODO:
* write $request and $errstr to log file for investigation
* and retries
*/
}
}
?>
Data Insertion Sample (Java)
This Java sample illustrates how to use Java classes to send an XML request.
This example sets the IP address, page name, and custom variables.
DataSubmission.java
package com.omniture;
import java.util.ArrayList;
import java.util.Iterator;
public class DataInsertion
{
private String rptSuiteID = null;
private String visitorID = null;
private StringBuffer buff = null;
private ArrayList<String> request = new ArrayList<String>();
public DataInsertion( String rsid, String vid )
{
this.rptSuiteID = rsid;
this.visitorID = vid;
}
public String toString()
{
buff = new StringBuffer();
buff.append( "<?xml version="1.0" encoding="UTF-8"?>n" );
buff.append( "<request>n" );
15Data Insertion API
buff.append( "<sc_xml_ver>1.0</sc_xml_ver>n" );
if( this.rptSuiteID != null )
buff.append( this.tagify( "reportsuiteid", this.rptSuiteID ) );
if( this.visitorID != null )
buff.append( this.tagify( "visitorid", this.visitorID ) );
Iterator iter = this.request.iterator();
while( iter.hasNext() )
{
buff.append( iter.next() );
}
buff.append( "</request>n" );
return buff.toString();
}
private String tagify( String name, String value )
{
return "<" + name + ">" + value + "</" + name + ">n";
}
private String tagify( String name, char value )
{
return "<" + name + ">" + value + "</" + name + ">n";
}
public void set( String tag, String value )
{
this.request.add( this.tagify(tag, value) );
}
public void set( String tag, char value )
{
this.request.add( this.tagify(tag, value) );
}
}
DataSubmission.java
package com.omniture;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
public class DataInsertionRequest
{
public static void main(String[] args) throws Exception
{
DataInsertion di = new DataInsertion( "test", "123456" );
di.set( "ipaddress", "127.0.0.1" );
di.set( "pagename", "Test Page" );
di.set( "channel", "Tests" );
di.set( "prop1", "All" );
di.set( "events", "event1" );
di.set( "evar2", "Test Page" );
di.set( "evar3", "Test Page" );
di.set( "evar4", "Test Page" );
di.set( "hier1", "Test|Test Page|All" );
URL url = null;
URLConnection urlConn = null;
DataOutputStream printout = null;
16Data Insertion API
BufferedReader input = null;
String u = "http://namespace.112.2o7.net/b/ss/ll/6";
String tmp = null;
url = new URL( u );
urlConn = url.openConnection();
urlConn.setDoInput( true );
urlConn.setDoOutput( true );
urlConn.setUseCaches( false );
urlConn.setRequestProperty( "Content-Type", "application/x-www-form-urlencoded"
);
printout = new DataOutputStream(urlConn.getOutputStream());
printout.writeBytes( di.toString() );
printout.flush();
printout.close();
input = new BufferedReader( new InputStreamReader( urlConn.getInputStream(
) ) );
System.out.println( di );
while( null != ( ( tmp = input.readLine() ) ) )
{
System.out.println( tmp );
}
printout.close();
input.close();
}
}
Data Insertion Sample (Python)
This Python sample illustrates how to access the Data Insertion API.
import httplib
xml='<?xml version="1.0" encoding="UTF-8"?>
<request> <scXmlVer>1.0</scXmlVer>
<reportSuiteID>Corp1_rs</reportSuiteID>
<timestamp>2010-03-20T10:33:22-07</timestamp> <visitorID>169</visitorID>
<ipAddress>10.0.0.1</ipAddress> <pageName>Test Page</pageName></request>'
conn = httplib.HTTPConnection("namespace.112.2o7.net:80")
conn.request("POST", "/b/ss//6",xml )
response = conn.getresponse()
print(response.status, response.reason)
print(response.read())
17Data Insertion API

Más contenido relacionado

La actualidad más candente

IoT Toolkit and the Smart Object API Tutorial Introduction
IoT Toolkit and the Smart Object API Tutorial IntroductionIoT Toolkit and the Smart Object API Tutorial Introduction
IoT Toolkit and the Smart Object API Tutorial Introduction
Michael Koster
 
AppSec EU 2016: Automated Mobile Application Security Assessment with MobSF
AppSec EU 2016: Automated Mobile Application Security Assessment with MobSFAppSec EU 2016: Automated Mobile Application Security Assessment with MobSF
AppSec EU 2016: Automated Mobile Application Security Assessment with MobSF
Ajin Abraham
 

La actualidad más candente (20)

Mphasis ppt on internet of things for internship
Mphasis ppt on internet of things for internshipMphasis ppt on internet of things for internship
Mphasis ppt on internet of things for internship
 
IoT Toolkit and the Smart Object API Tutorial Introduction
IoT Toolkit and the Smart Object API Tutorial IntroductionIoT Toolkit and the Smart Object API Tutorial Introduction
IoT Toolkit and the Smart Object API Tutorial Introduction
 
CEO Regression Analysis
CEO Regression AnalysisCEO Regression Analysis
CEO Regression Analysis
 
iot based home automation
iot based home automationiot based home automation
iot based home automation
 
introduction of Java beans
introduction of Java beansintroduction of Java beans
introduction of Java beans
 
Internet of everything ppt
Internet of everything pptInternet of everything ppt
Internet of everything ppt
 
Dependency Injection
Dependency InjectionDependency Injection
Dependency Injection
 
Command injection
Command injectionCommand injection
Command injection
 
Li-Fi technology
Li-Fi technologyLi-Fi technology
Li-Fi technology
 
Temperature measurement using nodemcu esp8266
Temperature measurement  using nodemcu esp8266Temperature measurement  using nodemcu esp8266
Temperature measurement using nodemcu esp8266
 
Nidhi ppt
Nidhi pptNidhi ppt
Nidhi ppt
 
Zigbee
ZigbeeZigbee
Zigbee
 
Home Automation System
Home Automation SystemHome Automation System
Home Automation System
 
Proxy Design Pattern
Proxy Design PatternProxy Design Pattern
Proxy Design Pattern
 
Iot
IotIot
Iot
 
Wifi technology
Wifi technologyWifi technology
Wifi technology
 
Home Automation using Iot
Home Automation using IotHome Automation using Iot
Home Automation using Iot
 
Low Power Wireless Technologies and Standards for the Internet of Things
Low Power Wireless Technologies and Standards for the Internet of ThingsLow Power Wireless Technologies and Standards for the Internet of Things
Low Power Wireless Technologies and Standards for the Internet of Things
 
iOS Application Pentesting
iOS Application PentestingiOS Application Pentesting
iOS Application Pentesting
 
AppSec EU 2016: Automated Mobile Application Security Assessment with MobSF
AppSec EU 2016: Automated Mobile Application Security Assessment with MobSFAppSec EU 2016: Automated Mobile Application Security Assessment with MobSF
AppSec EU 2016: Automated Mobile Application Security Assessment with MobSF
 

Similar a Data insertion api

Integrate Sas With Google Maps
Integrate Sas With Google MapsIntegrate Sas With Google Maps
Integrate Sas With Google Maps
vineetkaul
 
NetSuite Integrations - CuriousRubik
NetSuite Integrations - CuriousRubikNetSuite Integrations - CuriousRubik
NetSuite Integrations - CuriousRubik
CuriousRubik
 
Google Analytics What's Next (SVCC 2010)
Google Analytics What's Next (SVCC 2010)Google Analytics What's Next (SVCC 2010)
Google Analytics What's Next (SVCC 2010)
Massimo Paolini
 

Similar a Data insertion api (20)

Integrate Sas With Google Maps
Integrate Sas With Google MapsIntegrate Sas With Google Maps
Integrate Sas With Google Maps
 
Google Interface and Installation
Google Interface and InstallationGoogle Interface and Installation
Google Interface and Installation
 
S S H 1
S S H 1S S H 1
S S H 1
 
Ssh 1
Ssh 1Ssh 1
Ssh 1
 
Data Transformation Patterns in AWS - AWS Online Tech Talks
Data Transformation Patterns in AWS - AWS Online Tech TalksData Transformation Patterns in AWS - AWS Online Tech Talks
Data Transformation Patterns in AWS - AWS Online Tech Talks
 
NetSuite Integrations - CuriousRubik
NetSuite Integrations - CuriousRubikNetSuite Integrations - CuriousRubik
NetSuite Integrations - CuriousRubik
 
How to use Informatica Power Center as a RESTful Web Service Client?
How to use Informatica Power Center as a RESTful Web Service Client?How to use Informatica Power Center as a RESTful Web Service Client?
How to use Informatica Power Center as a RESTful Web Service Client?
 
Crea dashboard interattive con Amazon QuickSight
Crea dashboard interattive con Amazon QuickSightCrea dashboard interattive con Amazon QuickSight
Crea dashboard interattive con Amazon QuickSight
 
The Ultimate Guide to Ad0 e904 adobe workfront core developer certified exper...
The Ultimate Guide to Ad0 e904 adobe workfront core developer certified exper...The Ultimate Guide to Ad0 e904 adobe workfront core developer certified exper...
The Ultimate Guide to Ad0 e904 adobe workfront core developer certified exper...
 
Introduction to Amazon Athena
Introduction to Amazon AthenaIntroduction to Amazon Athena
Introduction to Amazon Athena
 
Ale idoc-guide
Ale idoc-guideAle idoc-guide
Ale idoc-guide
 
How to use Informatica Power Center as a RESTful Web Service Client?
How to use Informatica Power Center as a RESTful Web Service Client?How to use Informatica Power Center as a RESTful Web Service Client?
How to use Informatica Power Center as a RESTful Web Service Client?
 
Snowflake for Data Engineering
Snowflake for Data EngineeringSnowflake for Data Engineering
Snowflake for Data Engineering
 
RESTfulDay9
RESTfulDay9RESTfulDay9
RESTfulDay9
 
Active server pages
Active server pagesActive server pages
Active server pages
 
CData Power BI Connectors - MS Business Application Summit
CData Power BI Connectors - MS Business Application SummitCData Power BI Connectors - MS Business Application Summit
CData Power BI Connectors - MS Business Application Summit
 
Software as Service
Software as ServiceSoftware as Service
Software as Service
 
Modernizando plataforma de bi
Modernizando plataforma de biModernizando plataforma de bi
Modernizando plataforma de bi
 
Google Analytics What's Next (SVCC 2010)
Google Analytics What's Next (SVCC 2010)Google Analytics What's Next (SVCC 2010)
Google Analytics What's Next (SVCC 2010)
 
Sharepoint2
Sharepoint2Sharepoint2
Sharepoint2
 

Último

Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
amitlee9823
 
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
amitlee9823
 
Call Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night StandCall Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night Stand
amitlee9823
 
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
amitlee9823
 
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get CytotecAbortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Riyadh +966572737505 get cytotec
 
Probability Grade 10 Third Quarter Lessons
Probability Grade 10 Third Quarter LessonsProbability Grade 10 Third Quarter Lessons
Probability Grade 10 Third Quarter Lessons
JoseMangaJr1
 
👉 Amritsar Call Girl 👉📞 6367187148 👉📞 Just📲 Call Ruhi Call Girl Phone No Amri...
👉 Amritsar Call Girl 👉📞 6367187148 👉📞 Just📲 Call Ruhi Call Girl Phone No Amri...👉 Amritsar Call Girl 👉📞 6367187148 👉📞 Just📲 Call Ruhi Call Girl Phone No Amri...
👉 Amritsar Call Girl 👉📞 6367187148 👉📞 Just📲 Call Ruhi Call Girl Phone No Amri...
karishmasinghjnh
 
Call Girls Indiranagar Just Call 👗 9155563397 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 9155563397 👗 Top Class Call Girl Service B...Call Girls Indiranagar Just Call 👗 9155563397 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 9155563397 👗 Top Class Call Girl Service B...
only4webmaster01
 
➥🔝 7737669865 🔝▻ mahisagar Call-girls in Women Seeking Men 🔝mahisagar🔝 Esc...
➥🔝 7737669865 🔝▻ mahisagar Call-girls in Women Seeking Men  🔝mahisagar🔝   Esc...➥🔝 7737669865 🔝▻ mahisagar Call-girls in Women Seeking Men  🔝mahisagar🔝   Esc...
➥🔝 7737669865 🔝▻ mahisagar Call-girls in Women Seeking Men 🔝mahisagar🔝 Esc...
amitlee9823
 
Call Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service BangaloreCall Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
amitlee9823
 
Call Girls In Bellandur ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bellandur ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bellandur ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bellandur ☎ 7737669865 🥵 Book Your One night Stand
amitlee9823
 
CHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Call Girls In Doddaballapur Road ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Doddaballapur Road ☎ 7737669865 🥵 Book Your One night StandCall Girls In Doddaballapur Road ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Doddaballapur Road ☎ 7737669865 🥵 Book Your One night Stand
amitlee9823
 
➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men 🔝malwa🔝 Escorts Ser...
➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men  🔝malwa🔝   Escorts Ser...➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men  🔝malwa🔝   Escorts Ser...
➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men 🔝malwa🔝 Escorts Ser...
amitlee9823
 

Último (20)

Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
 
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
 
Call Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night StandCall Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night Stand
 
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
 
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get CytotecAbortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
 
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort ServiceBDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
 
Probability Grade 10 Third Quarter Lessons
Probability Grade 10 Third Quarter LessonsProbability Grade 10 Third Quarter Lessons
Probability Grade 10 Third Quarter Lessons
 
👉 Amritsar Call Girl 👉📞 6367187148 👉📞 Just📲 Call Ruhi Call Girl Phone No Amri...
👉 Amritsar Call Girl 👉📞 6367187148 👉📞 Just📲 Call Ruhi Call Girl Phone No Amri...👉 Amritsar Call Girl 👉📞 6367187148 👉📞 Just📲 Call Ruhi Call Girl Phone No Amri...
👉 Amritsar Call Girl 👉📞 6367187148 👉📞 Just📲 Call Ruhi Call Girl Phone No Amri...
 
DATA SUMMIT 24 Building Real-Time Pipelines With FLaNK
DATA SUMMIT 24  Building Real-Time Pipelines With FLaNKDATA SUMMIT 24  Building Real-Time Pipelines With FLaNK
DATA SUMMIT 24 Building Real-Time Pipelines With FLaNK
 
Call Girls Indiranagar Just Call 👗 9155563397 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 9155563397 👗 Top Class Call Girl Service B...Call Girls Indiranagar Just Call 👗 9155563397 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 9155563397 👗 Top Class Call Girl Service B...
 
Anomaly detection and data imputation within time series
Anomaly detection and data imputation within time seriesAnomaly detection and data imputation within time series
Anomaly detection and data imputation within time series
 
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
 
➥🔝 7737669865 🔝▻ mahisagar Call-girls in Women Seeking Men 🔝mahisagar🔝 Esc...
➥🔝 7737669865 🔝▻ mahisagar Call-girls in Women Seeking Men  🔝mahisagar🔝   Esc...➥🔝 7737669865 🔝▻ mahisagar Call-girls in Women Seeking Men  🔝mahisagar🔝   Esc...
➥🔝 7737669865 🔝▻ mahisagar Call-girls in Women Seeking Men 🔝mahisagar🔝 Esc...
 
Call Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service BangaloreCall Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
 
Call Girls In Bellandur ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bellandur ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bellandur ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bellandur ☎ 7737669865 🥵 Book Your One night Stand
 
CHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Call Girls In Doddaballapur Road ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Doddaballapur Road ☎ 7737669865 🥵 Book Your One night StandCall Girls In Doddaballapur Road ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Doddaballapur Road ☎ 7737669865 🥵 Book Your One night Stand
 
Midocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxMidocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFx
 
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
 
➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men 🔝malwa🔝 Escorts Ser...
➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men  🔝malwa🔝   Escorts Ser...➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men  🔝malwa🔝   Escorts Ser...
➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men 🔝malwa🔝 Escorts Ser...
 

Data insertion api

  • 2. Contents Data Insertion API.............................................................................................................3 Overview...............................................................................................................................................................................3 Data Insertion Process...............................................................................................................................................................................3 Visitor Identification...................................................................................................................................................................................4 Sequential Data Requirements..............................................................................................................................................................5 Delayed Data.................................................................................................................................................................................................5 HTTP 1.1..........................................................................................................................................................................................................6 Limitations.....................................................................................................................................................................................................6 Reference..............................................................................................................................................................................6 Supported XML Tags and Query Variables........................................................................................................................................7 POST Response Codes.............................................................................................................................................................................10 Sample Code.....................................................................................................................................................................11 HTTP POST Sample...................................................................................................................................................................................11 HTTP GET Sample......................................................................................................................................................................................13 Data Insertion Sample (PHP).................................................................................................................................................................14 Data Insertion Sample (Java)................................................................................................................................................................15 Data Insertion Sample (Python)...........................................................................................................................................................17 Adobe Analytics Data Insertion APILast updated 9/24/2013
  • 3. Data Insertion API The Data Insertion API supports HTTP POST and HTTP GET for submitting data to Adobe Marketing Cloud servers. Overview The Data Insertion API provides a mechanism for server-side data collection and submission to Marketing Cloud servers. Instead of using JavaScript beacons on each Web page to transmit visitor data to Online Marketing Suite servers, server-side data collection collects data based solely on Web browser requests and Web server responses. While this data capture method cannot capture all data that is available via page-based beacons, it provides valuable insight into user activity on your Web pages without the overhead associated with attaching a JavaScript beacon to every Web page. Data Insertion Process The Data Insertion API supports HTTP POST and HTTP GET for submitting data to Adobe Marketing Cloud servers. Note: The Analytics response to each data insertion includes a status message (SUCCESS or FAILURE). HTTP POST Use an HTTP POST to submit properly-formatted Data Insertion XML to the Data Insertion URL. The Data Insertion URL differs from the standard JavaScript data submission URL. Adobe ClientCare can provide the domain name of the Adobe data collection servers where you should send data. For example: http://namespace.112.2o7.net/b/ss//6 http://namespace.122.2o7.net/b/ss//6 Note: The "6" code at the end of the URL indicates that the data submission requires XML processing. Upon receipt, Adobe servers perform basic tag validation of the data insertion. If it encounters an error, Adobe returns a Failure response. If the data insertion is successful, Adobe queues the data insertion request for processing by the standard Analytics Data Processing Engine. The engine processes these requests in the same way it processes data collected via JavaScript. When using HTTP POST with the Data Insertion API, consider the following: • The Data Insertion API requires data in UTF-8 format. Specify the character encoding in the opening XML tag, as shown in XML Data Insertion Format. • Replace Ampersand (&), greater-than (>), and less-than (<) symbols with their HTML equivalents when passing them into a Analytics variable. For example, submit <evar1>News & Sports <local> </evar1> as <evar1>News &amp; Sports &lt;local&gt; </evar1>. • To submit data over an encrypted connection, the application must be configured to support HTTPS POST commands. Some tools that let you do this include: • PHP versions 4.3.0 and higher support OpenSSL, and can be used to POST data through SSL port 443. You can see an example of this in Sample Data Insertion (PHP). • You can use cURL to send data over an SSL connection. For information about HTTPS POST in Java, see http://java.sun.com/developer/technicalArticles/Security/secureinternet/. 3Data Insertion API
  • 4. • Microsoft .Net Framework version 1.1 supports the HTTP header: Expect: 100-Continue in HTTP POST requests, but Marketing Cloud servers reject POST data sent with this type of request. To avoid this, set ServicePointManager.Expect100Continue = False. For more information, see http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemnetservicepointmanagerclassexpect100continuetopic.asp . HTTP GET Use an HTTP GET to submit data to the Data Insertion URL in a query-string format that supports shortened variable names (for more information, see "Variables and Query String Parameters" in the Analytics Implementation Guide, available at Help > Documentation in the Marketing Cloud. HTTP GET reduces bandwidth needs by 30% - 40%, but Adobe data collection servers do not send response messages, so if the data insertion doesn't work as expected, you do not have that feedback for troubleshooting purposes. For more information, see the HTTP GET Sample. The Data Insertion URL differs from the standard JavaScript data submission URL. The <rsid> in the URL is the report suite where you want to submit the data. Adobe ClientCare can provide the domain name of the Adobe data collection servers where you should send data. For example: http://namespace.112.2o7.net/b/ss/<rsid>/0 http://namespace.122.2o7.net/b/ss/<rsid>/0 Note: The "0" code at the end of the URL indicates that the data submission requires JavaScript processing. For example: Upon receipt, Adobe servers perform basic tag validation of the data insertion. If it encounters an error, Adobe returns a Failure response. If the data insertion is successful, Adobe queues the data insertion request for processing by the standard Analytics Data Processing Engine. The engine processes these requests in the same way it processes data collected via JavaScript. Note: The Data Insertion API requires data in UTF-8 format. Visitor Identification To track site visitors, each visitor must have a unique visitor ID. Ideally, this is a persistent cookie with an extended expiration period (5 years or more.) Use the visitorID tag, the combination of IP address and userAgent, to submit visitor ID information to Adobe data collection servers. The visitorID variable supports up to 100 alpha-numeric characters and cannot contain a hyphen. If the data insertion includes a visitorID, the Analytics Data Processing Engine assumes that persistent cookies are enabled for the visitor's Web browser. If the data insertion identifies visitors using IP address/User Agent, Analytics displays persistent cookies for that visitor as disabled. Note: To avoid processing problems, make sure that visitorID is a uniformly distributed random number. The visitorID is critical for linking a visitor's activities captured via JavaScript with those submitted through tagless data collection, or a third-party application. For example, to link a visitor's browsing activity with transactions in a third-party shopping cart application, you must pass the visitorID to the shopping cart application. The shopping cart application uses the visitorID when uploading transaction data via the Data Insertion API so Analytics can link the transaction data to the visitor's browsing activity (previously captured via JavaScript). 4Data Insertion API
  • 5. Typically, the client systems generate unique visitor identifiers that you can use as the visitorID value. We recommend generating your own visitor id, in both the XML and in the JavaScript so that the values match. Sequential Data Requirements To ensure accurate visitor pathing and commerce data, applications must send visitor data in the order it was received. The Analytics Data Processing Engine closes a visit after 30 minutes without receiving data. When simulating previously recorded traffic, Adobe recommends that data insertions mimic the time delays between visitor events on the site. For example, if the application records page views for a given visitor 2, 4, and 5 seconds apart, send those page views to Analytics using the same cadence. If the application cannot mimic the original event timing, Adobe recommends sending sequential data insertions 3 seconds apart, per visitor, to help avoid out-of-order data processing. Delayed Data By using the Data Insertion API, you can submit delayed data (for example, from an offline application, to Adobe data collection servers. Note: Data from delayed submissions is available to Data Warehouse and Ad hoc analysis. When submitting delayed data, you must send visitor data in the order it was received, (see Sequential Data Requirements) but you do not need to send data for different visitors in any specific order. For example, you can submit all data for visitor A before data for visitor B, even if some or all of visitor B data occurred before visitor A data. Submitting delayed data requires an additional <timestamp> tag in the XML. Analytics discards data without a timestamp. Note: To view time-stamped hits, Adobe ClientCare must enable time-stamp support on the report suite, in addition to the time-stamp variable that you set. Time-stamped hits sent to a report suite that has not been enabled do not appear in the report. Format the timestamp data, including time zone, using either the Unix timestamp format or the ISO-8601 format. For example, using the ISO-8601 format, a timestamp for a visitor event that occurred on November 17, 2009 at 5:33 PM Mountain Time (GMT-7:00:00) is as follows: 2009-11-17T17:33:22-07 Consider the following when submitting delayed (time-stamped) data: • While a report suite is collecting time-stamped data, it cannot collect data through the standard JavaScript beacon method. • You must enable time stamp support on a per-report-suite basis. • When submitting data delayed by more than 30 minutes, do so without any pauses in the data transmission to make sure Analytics processes it as a single visit. Analytics might process delayed data as separate visits if there is more than a 100-second pause between transmission batches. • You can also use Data Sources to send this type of data to the Marketing Cloud via FTP. For more information, see the Data Sources User Guide. 5Data Insertion API
  • 6. HTTP 1.1 Adobe data collection servers support HTTP 1.1. Using HTTP 1.1, you can send multiple POST requests in a single session. However, when using HTTP 1.1, be aware of the following: • While a report suite is collecting time-stamped data, it cannot collect data through the standard JavaScript beacon method. • Adobe data collection servers limit the number of HTTP requests per HTTP session. To account for this, make sure your application can detect closed sessions and respond appropriately. • Adobe data collection servers observe HTTP 1.1 rules when chunking content. Make sure your application properly interprets the chunking numbers provided in the Online Marketing Suite server response to your data insertion. For example, in the following HTTP 1.1 response, the numbers 68 and 0 are chunking numbers, which represent the number of bytes to read before the next chunk. TTP/1.1 200 OK Date: Thu, 07 Dec 2008 15:48:51 GMT Expires: Wed, 06 Dec 2008 15:48:51 GMT Last-Modified: Fri, 08 Dec 2008 15:48:51 GMT Cache-Control: no-cache, no-store, must-revalidate, max-age=0, proxy-revalidate, no-transform, private Pragma: no-cache ETag: "457837E3-649A-4BBB9314" Vary: * P3P: policyref="/w3c/p3p.xml", CP="NOI DSP COR NID PSA OUR IND COM NAV STA" Transfer-Encoding: chunked Content-Type: text/xml 68 <?xml version="1.0" encoding="UTF-8"?> <status>FAILURE</status> <reason>NO pagename OR pageurl</reason> 0 Limitations There are some limitations to server-side data collection when compared to client-side data collection using JavaScript. • Server-side data collection cannot collect Web browser configuration data. • Server-side data collection cannot collect ClickMap data. • Server-side data collection loses cached page navigation data because using a Web browser's back button or reloading a cached page does not generate additional server requests or responses. This limits pathing data available for Analytics reports. • Typically, bots do not run JavaScript when requesting a page, and do not request the page's image tags. However, server-side data collection includes requests from bots and spiders. • You must have control over the servers from which you want to collect data. If you use a Content Delivery Network (CDN) such as Akamai* to deliver web pages, the server-side data collection described here cannot collect data for those pages. • If you control most of your Web site pages, but use some third-party services (for example, surveys or shopping cart systems), server-side data collection cannot collect data from the third-party pages. You should use JavaScript tagging on third-party pages that request content from your Web servers to gain visibility into those systems. • Server-side data collection alone cannot provide cross-domain tracking of site visitors. However, you can use the <visitorID> tag in conjunction with client-side JavaScript data collection to pass additional information to the server. This is the only way that cross-domain tracking is possible when using a <visitorID>. • Server-side data collection can co-exist with a client-side (JavaScript) implementation only if clients submit server-side data in near real-time. If clients have a JavaScript beacon implementation, and want to collect server-side data and submit it in batches, they should use Data Sources, not the Data Insertion API. Reference Data insertion API reference topics. This section contains details on supported XML tags and POST response codes. 6Data Insertion API
  • 7. Supported XML Tags and Query Variables When processing HTTP POST data submissions, only values in supported XML tags are processed. When submitting HTTP GET data submissions, only specified query string and HTTP header variables are processed. The following table lists all supported XML tags, along with their associated query string variable equivalents and HTTP header variable equivalents, where applicable. The JavaScript variable column is provided for reference. Every data insertion must include either <pageName> and/or <pageURL>. Every data insertion must also include either <visitorID> and/or <IPaddress>. Description HTTP Header Var JavaScript Variable Query String Parameter (GET) XML Tag (POST) Browser height in pixels (For example, 768). N/AN/A bh<browserHeight> Browser width in pixels (For example, 1024). N/AN/A bw<browserWidth> The campaign tracking code associated with the page. N/Acampaign v0<campaign> The page title or bread crumb.N/Achannel ch<channel> Monitor color depth in bits (For example, 24). N/AN/A c<colorDepth> Visitor's connection type ("lan" or "modem"). N/AN/A ct<connectionType> Key-values pairs are specified in one of the following formats: N/AcontextData c.[key]<contextData> <my.a>red</my.a> or: <my><a>red</a></my> Each of these examples result in a context data value of my.a = red. Multiple key-value pairs can be specified. In the query string, this context data variable would appear as c.my.a=red 7Data Insertion API
  • 8. Description HTTP Header Var JavaScript Variable Query String Parameter (GET) XML Tag (POST) Whether the visitor supports first party session cookies (Y or N). N/AN/A k<cookiesEnabled> Revenue currency code For example, USD. N/AcurrencyCode cc<currencyCode> Analytics eVar.N/AeVar1 - eVar75 v# For example, v2. <eVar#> For example, <eVar2>. A list of Analytics events.N/Aevents events<events> A hierarchy string.N/Ahier1 - hier5 h# For example, h2 <hiern> For example, <hier2>. Whether the current page is the visitor's homepage (Y or N). N/AN/A hp<homePage> The visitor's IP address.X-Forwarded-ForN/AN/A <ipaddress> Whether the visitor has Java enabled (Y or N). N/AN/A v<javaEnabled> JavaScript version. For example, 1.3.N/AN/A j<javaScriptVersion> The browser's supported language. For example, "en-us". Accept-LanguageN/A N/A<language> Name of link.N/AlinkName pev2<linkName> Type of link ("d", "e", or "o").N/AlinkType pe<linkType> The link's HREF. For custom links, page values are ignored. N/AlinkURL pev1<linkURL> A delimited list of values that are passed into a variable, then reported N/Alist1 - list3 l#<listn> For example, <list2>. as individual line items for reporting. The Web page name.N/ApageName pageName<pageName> 8Data Insertion API
  • 9. Description HTTP Header Var JavaScript Variable Query String Parameter (GET) XML Tag (POST) The Web page type. This is only used on 404 error pages. Set N/ApageType pageType<pageType> pageType to "Error Page" for when a 404 error is detected. The Web page URL For example, http://www.mysite.com/index.html. N/ApageURL g<pageURL> Semicolon separated list of Netscape plug-in names. N/AN/A p<plugins> List of all products on the page. Separate products with a comma. N/Aproducts products<products> For example: Sports;Ball;1;5.95, Toys; Top;1:1.99. Analytics property name.N/Aprop1 - prop75 c# For example, c2 <propn> Forexample, <prop2> Purchase ID number.N/ApurchaseID purchaseID<purchaseID> The URL of the page referrer.N/AN/A r<referrer> Specifies the report suites where you want to submit data. Separate N/As_account Contained in the URL. See HTTP GET Sample. <reportSuiteID> multiple report suite IDs with a comma. Monitor resolution For example, 1280x1024. N/AN/A s<resolution> Analytics XML request version number. For example, 1.0. N/AN/AN/A <scXmlVer> The Web server serving the page.N/Aserver server<server> The visitor's U.S. state.N/Astate state<state> The time and date on which the data was collected. N/Atimestamp ts<timestamp> 9Data Insertion API
  • 10. Description HTTP Header Var JavaScript Variable Query String Parameter (GET) XML Tag (POST) XML POST: Visitor's time zone offset from GMT in hours. For example, -8. N/AN/APart of the t parameter <timezone> GET: The visitor's time zone is included in the t query string parameter, which contains the local time. The t parameter is in the following format: dd/mm/yyyy hh:mm:ss D OFFSET Where D is a number in the range 0-6 specifying the day of the week, and OFFSET represents: offset from GMT in hours * 60 * - 1 For example: 09/23/2013 14:00:00 1 420 Common value used to tie multi-channel user activities N/AtransactionID xact<transactionID> together for reporting purposes. For more information, see the Data Sources User Guide. The visitor's browser type and OS.User-AgentN/AN/A <userAgent> Visitor's unique identifying cookie. See "Visitor Information" in N/AN/A vid<visitorID> "Understanding the Data Insertion API". The visitor's zip code.N/Azip zip<zip> POST Response Codes The Data Insertion API supports these response messages to HTTP POST operations. The following table lists all supported XML tags, along with their associated JavaScript variable equivalents and HTTP header variable equivalents, where applicable. ponse messages can help you understand and correct the problem. 10Data Insertion API
  • 11. DescriptionPOST Response Success (general) <?xml version="1.0" encoding="UTF-8"?><?xml version="1.0" encoding="UTF-8"?><status>SUCCESS</status> Failure (general) <?xml version="1.0" encoding="UTF-8"?><?xml version="1.0" encoding="UTF-8"?><status>FAILURE</status> Failure (missing required report suite id) <?xml version="1.0" encoding="UTF-8"?><?xml version="1.0" encoding="UTF-8"?><status>FAILURE</status> <reason>NO account</reason> Failure (missing required page name or page URL) <?xml version="1.0" encoding="UTF-8"?><?xml version="1.0" encoding="UTF-8"?><status>FAILURE</status> <reason>NO pagename OR pageurl</reason> Failure (missing required visitor id or IP address) <?xml version="1.0" encoding="UTF-8"?><?xml version="1.0" encoding="UTF-8"?><status>FAILURE</status> <reason>NO visitorid OR ipaddress</reason> Failure (syntax error: includes malformed XML, non-encoded reserved characters, etc.) <?xml version="1.0" encoding="UTF-8"?><?xml version="1.0" encoding="UTF-8"?><status>FAILURE</status> <reason>Syntax Error</reason> Sample Code The Data Insertion API includes these code samples. Note: Do not copy-and-paste these code samples. They use generic values that you must replace with valid data appropriate to your application. HTTP POST Sample This sample displays the structure of an HTTP POST request and response using the Data Insertion API. Note: Do not copy-and-paste these code samples. They use generic values that you must replace with valid data appropriate to your application. The [rsid] parameter identifies the report suite where you want to submit the data. Other values, such as PageURL, are sample values only. HTTP 1.0 POST Request POST /b/ss//6 HTTP/1.0 Host: [rsid].112.2o7.net Content-Length: 593 <?xml version=1.0 encoding=UTF-8?> <request> <sc_xml_ver>1.0</sc_xml_ver> <pageURL>apps.sillystring.com/summary.do</pageURL> <referrer>http://apps.sillystring.com/summary.do</referrer> <ipAddress>192.168.10.1</ipAddress> <pageName>summary</pageName> <eVar2>14911</eVar2> 11Data Insertion API
  • 12. <userAgent>Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.0.04506)</userAgent> <prop10>Brazil</prop10> <visitorID>1286556420966514130</visitorID> <timestamp>2009-03-05T01:00:01-05</timestamp> <reportSuiteID>[rsid]</reportSuiteID> </request> HTTP POST Response HTTP/1.1 200 OK Date: Wed, 13 May 2009 16:26:47 GMT X-C: ms-3.7.2 Expires: Tue, 12 May 2009 16:26:47 GMT Last-Modified: Thu, 14 May 2009 16:26:47 GMT Cache-Control: no-cache, no-store, must-revalidate, max-age=0, proxy-revalidate, no-transform, private Pragma: no-cache ETag: "4A0AF4C7-08E1-37C7F492" Vary: * P3P: policyref="/w3c/p3p.xml", CP="NOI DSP COR NID PSA OUR IND COM NAV STA" xserver: www79 Connection: close Content-Type: text/xml <?xml version="1.0" encoding="UTF-8"?> <status>SUCCESS</status> HTTP 1.1 POST Request POST /b/ss//6 HTTP/1.1 Host: [rsid].112.2o7.net Keep-Alive: timeout=15 Connection: Keep-Alive Content-Length: 593 <?xml version=1.0 encoding=UTF-8?> <request> <sc_xml_ver>1.0</sc_xml_ver> <pageURL>apps.sillystring.com/summary.do</pageURL> <referrer>http://apps.sillystring.com/summary.do</referrer> <ipAddress>192.168.10.1</ipAddress> <pageName>summary</pageName> <eVar2>14911</eVar2> <userAgent>Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.0.04506)</userAgent> <prop10>Brazil</prop10> <visitorID>1286556420966514130</visitorID> <timestamp>2009-03-05T01:00:01-05</timestamp> <reportSuiteID>[rsid]</reportSuiteID> </request> HTTP 1.1 POST Response HTTP/1.1 200 OK Date: Wed, 13 May 2009 16:25:12 GMT X-C: ms-3.7.2 Expires: Tue, 12 May 2009 16:25:12 GMT Last-Modified: Thu, 14 May 2009 16:25:12 GMT Cache-Control: no-cache, no-store, must-revalidate, max-age=0, proxy-revalidate, no-transform, private Pragma: no-cache ETag: "4A0AF468-4DF2-33AE9089" Vary: * P3P: policyref="/w3c/p3p.xml", CP="NOI DSP COR NID PSA OUR IND COM NAV STA" xserver: www116 Keep-Alive: timeout=15 Connection: Keep-Alive Content-Length: 40 Content-Type: text/xml 12Data Insertion API
  • 13. <?xml version="1.0" encoding="UTF-8"?> <status>SUCCESS</status> HTTP GET Sample This sample displays the structure of an HTTP GET request and response using the Data Insertion API. The [rsid] parameter identifies the report suite where you want to submit the data. Other values, such as PageURL, are sample values only. Note: Do not copy-and-paste these code samples. They use generic values that you must replace with valid data appropriate to your application. HTTP 1.0 GET Request GET /b/ss/[rsid]/0?g=apps.sillystring.com%2Fsummary.do&r=http%3A%2F%2Fapps.sillystring.com% 2Fsummary.do&ip=192.168.10.1&gn= summary&v2=14911&c10=Brazil&vid=1286556420966514130&ts=2009-03-05T01%3A00%3A01-05 HTTP/1.0 Host: [rsid].112.2o7.net X-Forwarded-For: 192.168.10.1 HTTP 1.0 GET Response HTTP/1.0 200 OK Date: Wed, 13 May 2009 16:26:47 GMT X-C: ms-3.7.2 Expires: Tue, 12 May 2009 16:26:47 GMT Last-Modified: Thu, 14 May 2009 16:26:47 GMT Cache-Control: no-cache, no-store, must-revalidate, max-age=0, proxy-revalidate, no-transform, private Pragma: no-cache ETag: "49F5FD79-3E44-38021808" Vary: * P3P: policyref="/w3c/p3p.xml", CP="NOI DSP COR NID PSA OUR IND COM NAV STA" xserver: www83 Connection: close Content-Type: text/html HTTP 1.1 GET Request GET /b/ss/[rsid]/0?g=apps.sillystring.com%2Fsummary.do&r=http%3A%2F%2Fapps.sillystring.com% 2Fsummary.do&ip=192.168.10.1&gn=summary&v2=14911&c10=Brazil&vid=1286556420966514130&ts=2009-03-05T01%3A00%3A01-05 HTTP/1.1 Host: [rsid].112.2o7.net Keep-Alive: timeout=15 Connection: Keep-Alive X-Forwarded-For: 192.168.10.1 HTTP 1.1 GET Response HTTP/1.1 200 OK Date: Mon, 19 Oct 2009 17:26:24 GMT Server: Omniture DC/2.0.0 X-C: ms-4.1.3 Expires: Thu, 01 Jan 1970 00:20:55 GMT Last-Modified: Thu, 01 Jan 1970 00:20:56 GMT Cache-Control: no-cache, no-store, must-revalidate, max-age=0, proxy-revalidate, no-transform, private Pragma: no-cache ETag: "4ADCA140-6E16-1FADA4C7" Vary: * P3P: policyref="/w3c/p3p.xml", CP="NOI DSP COR NID PSA OUR IND COM NAV STA" xserver: www176 Content-Length: 43 13Data Insertion API
  • 14. Keep-Alive: timeout=15 Connection: Keep-Alive Content-Type: image/gif Data Insertion Sample (PHP) This PHP sample illustrates how to connect to Adobe data collection servers and record a page view. <?/ ** * @file * Example code to send one pageview to Omniture via the Data Insertion API * and check for a valid response. * * @author Omniture, an Adobe Company <clientcare@omniture.com> * @copyright 2007-2010 Adobe Systems, Inc. All Rights Reserved. */ // NOTE: Contact an ClientCare to identify the correct namespace and domain for your company. $namespace = "namespace"; $domain = "112.2o7.net"; $host = $namespace.".".$domain; $rsid = "rsid"; $vid = ""; $ip = "10.0.0.1"; $page_url = ""; $pageName = "Test Page"; $timestamp = "2008-10-21T17:33:22-07"; // create opening XML tags $xml = "<?xml version=1.0 encoding=UTF-8?>n"; $xml .= "<request>n"; $xml .= " <scXmlVer>1.0</scXmlVer>n"; // add tags for required elements $xml .= $rsid ? " <reportSuiteID>$rsid</reportSuiteID>n":""; //The timestamp line of code can only be used when an Omniture representitive has enabled timestamp support for your organization. $xml .= $timestamp ? " <timestamp>$timestamp</timestamp>n":""; $xml .= $vid ? " <visitorID>$vid</visitorID>n":""; $xml .= $ip ? " <ipAddress>$ip</ipAddress>n":""; $xml .= $page_url ? " <pageURL>$page_url</pageURL>n":""; $xml .= $pageName ? " <pageName>$pageName</pageName>n":""; // close the XML request $xml .= "</request>n"; // Create POST, Host and Content-Length headers $head = "POST /b/ss//6 HTTP/1.0n"; $head .= "Host: $hostn"; $head .= "Content-Length: ".(string)strlen($xml)."nn"; // combine the head and XML $request = $head.$xml; $fp=fsockopen($host,80,$errno,$errstr,30); // Use this function in place of the call above if you have PHP 4.3.0 or // higher and have compiled OpenSSL into the build. // // $fp = pfsockopen("ssl://".$host, 443, $errno, $errstr); // if( $fp ) { // send data fwrite($fp,$request); 14Data Insertion API
  • 15. // get response $response=""; while( !feof($fp) ){ $response .= fgets($fp,1028); } fclose($fp); // display results echo "RESULTS:n"; print_r($response); echo "n"; // check for errors if( preg_match("/status>FAILURE</status/im",$response) ){ /* * TODO: * write $request and $response to log file for investigation * and retries */ echo "<h1>Failure</h1>n"; echo "<p>Note the reason tag in the response, fix and try again.</h1>n"; } } else { echo "<H1>Couldn't open port to Analytics servers</H1>n"; if(!$rsid){ echo "<H4>No report suite specified</H4>n"; } else { echo "<p>$errstr ($errno)</p>n"; /* * TODO: * write $request and $errstr to log file for investigation * and retries */ } } ?> Data Insertion Sample (Java) This Java sample illustrates how to use Java classes to send an XML request. This example sets the IP address, page name, and custom variables. DataSubmission.java package com.omniture; import java.util.ArrayList; import java.util.Iterator; public class DataInsertion { private String rptSuiteID = null; private String visitorID = null; private StringBuffer buff = null; private ArrayList<String> request = new ArrayList<String>(); public DataInsertion( String rsid, String vid ) { this.rptSuiteID = rsid; this.visitorID = vid; } public String toString() { buff = new StringBuffer(); buff.append( "<?xml version="1.0" encoding="UTF-8"?>n" ); buff.append( "<request>n" ); 15Data Insertion API
  • 16. buff.append( "<sc_xml_ver>1.0</sc_xml_ver>n" ); if( this.rptSuiteID != null ) buff.append( this.tagify( "reportsuiteid", this.rptSuiteID ) ); if( this.visitorID != null ) buff.append( this.tagify( "visitorid", this.visitorID ) ); Iterator iter = this.request.iterator(); while( iter.hasNext() ) { buff.append( iter.next() ); } buff.append( "</request>n" ); return buff.toString(); } private String tagify( String name, String value ) { return "<" + name + ">" + value + "</" + name + ">n"; } private String tagify( String name, char value ) { return "<" + name + ">" + value + "</" + name + ">n"; } public void set( String tag, String value ) { this.request.add( this.tagify(tag, value) ); } public void set( String tag, char value ) { this.request.add( this.tagify(tag, value) ); } } DataSubmission.java package com.omniture; import java.io.BufferedReader; import java.io.DataOutputStream; import java.io.InputStreamReader; import java.net.URL; import java.net.URLConnection; public class DataInsertionRequest { public static void main(String[] args) throws Exception { DataInsertion di = new DataInsertion( "test", "123456" ); di.set( "ipaddress", "127.0.0.1" ); di.set( "pagename", "Test Page" ); di.set( "channel", "Tests" ); di.set( "prop1", "All" ); di.set( "events", "event1" ); di.set( "evar2", "Test Page" ); di.set( "evar3", "Test Page" ); di.set( "evar4", "Test Page" ); di.set( "hier1", "Test|Test Page|All" ); URL url = null; URLConnection urlConn = null; DataOutputStream printout = null; 16Data Insertion API
  • 17. BufferedReader input = null; String u = "http://namespace.112.2o7.net/b/ss/ll/6"; String tmp = null; url = new URL( u ); urlConn = url.openConnection(); urlConn.setDoInput( true ); urlConn.setDoOutput( true ); urlConn.setUseCaches( false ); urlConn.setRequestProperty( "Content-Type", "application/x-www-form-urlencoded" ); printout = new DataOutputStream(urlConn.getOutputStream()); printout.writeBytes( di.toString() ); printout.flush(); printout.close(); input = new BufferedReader( new InputStreamReader( urlConn.getInputStream( ) ) ); System.out.println( di ); while( null != ( ( tmp = input.readLine() ) ) ) { System.out.println( tmp ); } printout.close(); input.close(); } } Data Insertion Sample (Python) This Python sample illustrates how to access the Data Insertion API. import httplib xml='<?xml version="1.0" encoding="UTF-8"?> <request> <scXmlVer>1.0</scXmlVer> <reportSuiteID>Corp1_rs</reportSuiteID> <timestamp>2010-03-20T10:33:22-07</timestamp> <visitorID>169</visitorID> <ipAddress>10.0.0.1</ipAddress> <pageName>Test Page</pageName></request>' conn = httplib.HTTPConnection("namespace.112.2o7.net:80") conn.request("POST", "/b/ss//6",xml ) response = conn.getresponse() print(response.status, response.reason) print(response.read()) 17Data Insertion API