Opomba:

 

This article has been authored and contributed by Alexis Cazes, Lead Technical Support engineer at Adobe. 

Steps to implement Adobe Analytics data insertion API using POST

Tracking server

Choose an RDC tracking server

For best performance it is advised to use an RDC tracking server. This should decrease the response time from Adobe Servers. If you are using a tracking server that uses 2o7.net then it is advise to use the corresponding RDC server. This will not impact the tracking as data insertion API does not set a cookie at all. Change of tracking server impacts JavScript implement as the cookie will be set on a new domain and therefore the user will get a new Visitor ID but with Data insertion API it does not matter! It is important that you know in which Data Center your Adobe Analytics company is located. From this, you can deduct which tracking server to use.

Data Center 2o7.net base tracking server RDC base tracking server
SAN JOSE 112.2o7.net d1.sc.omtrdc.net (sc.omtrdc.net for report suite create in 2014 onwards)
DALLAS 122.2o7.net d2.sc.omtrdc.net (sc.omtrdc.net for report suite create in 2014 onwards)
PACIFIC NORTHWEST N/A sc.omtrdc.net
LONDON N/A d3.sc.omtrdc.net (sc.omtrdc.net for report suite create in 2014 onwards)
SINGAPORE N/A sc.omtrdc.net

Choose a Unique namespace

If you are using CNAME there is no need to prepend your CNAME tracking server (First Party Cookie) with a NameSpace. Your CNAME is already mapped to a tracking server that already uses a unique namespace.

Why use a namespace ?

Data collection requires a unique subdomain to keep visitor data separate across Adobe Marketing Cloud customers. It is prefixed to the data center address, and is generally your Adobe Analytics login company name with all spaces removed. You can technically use whatever subdomain you'd like, however it is highly recommended to be specific enough that:No other Adobe Marketing Cloud customer would use it.You are consistent with the subdomain across all report suites, especially if your organization uses a global report suite.

Syntax of tracking server with the Namespace

You can use any namespace as you wish!

Data Center RDC base tracking server with namespace
SAN JOSE [NAMESPACE].d1.sc.omtrdc.net ([NAMESPACE].sc.omtrdc.net for report suite create in 2014 onwards)
DALLAS [NAMESPACE].d2.sc.omtrdc.net ([NAMESPACE].sc.omtrdc.net for report suite create in 2014 onwards)
PACIFIC NORTHWEST [NAMESPACE].sc.omtrdc.net
LONDON [NAMESPACE].d3.sc.omtrdc.net ([NAMESPACE].sc.omtrdc.net for report suite create in 2014 onwards)
SINGAPORE [NAMESPACE].sc.omtrdc.net

FAQ about tracking servers

Can I use the same trackingServer as in my JavaScript implementation (H code verion or AppMeasurement.js)?

CNAME

  • If you are using CNAME and the CNAME is mapped to a RDC tracking server then you can reuse this trackingServer in your Data Insertion API
  • If you are using CNAME and your CNAME is NOT mapped to an RDC tracking server then it is advised to use a default RDC tracking server due to its benefits or migrate your CNAME mapping to RDC (Contact Adobe ClientCare)

NON - CNAME

  • If you already using a default RDC tracking server in your JavaScript implementation then reuse this one in your Data Insertion API
  • If you are still using a 207.net tracking server then make sure to use and RDC one with Data Insertion API

Can I use my CNAME tracking server ?

If you are using a CNAME in your JavaScipt implementation then do the following:

  • Open a command prompt in windows
  • Input the following command
ping CNAMETrackingServer
  • If the ping is successful and resolves to a RDC trackingServer then use it
  • If the ping is successful and resolves to a 2o7.net tracking server then do not use it. Simply use a default RDC tracking server.

Built the Data Insertion URL

The data insertion API should look as follow for default RDC:

http://[NAMESPACE].[TRACKING SERVRER]/b/ss//6

The data insertion API should look as follow for CNAME that resolves to RDC

http://[CNAME TRACKING SERVER]/b/ss//6

IMPORTANT

  • It is important that you respect the syntax above.
  • Do not put the Report Suite ID in the URL put it in the XML

Visitor ID

It is important that you provide a unique ID for each visitor. If you provide the same visitor ID then you will only get one unique visitor in Adobe Analytics and all conversion event and eVar allocation will be incorrect.

For Visitor Identification the following 5 types are used in Adobe Analytics. s_vi and AMCV are the one 99% of implementation are using:

Order Used Query Parameter (collection method) post_visid_type column value Present When
1 vid (s.visitorID) 0 s.visitorID is set.
2 aid (s_vi cookie) 3 Visitor had an existing s_vi cookie before you deployed the Visitor ID service, or you have a Visitor ID grace period configured.
3 mid (AMCV_ cookie set by Marketing Cloud Visitor ID service) 5 Visitor's browser accepts cookies (first-party), and the Marketing Cloud Visitor ID service is deployed.
4 fid (fallback cookie on H.25.3 or newer, or AppMeasurement for JavaScript) 4 Visitor's browser accepts cookies (first-party).
5 HTTP Mobile Subscriber header 2 Device is recognized as a mobile device.
6 IP Address, User Agent, Gateway IP Address 1 Visitor's browser does not accept cookies.

Check the timestamp status of your report suite

Each report suite in Adobe Analytics can have one of these 3 timestamp settings:

Timestamp required : the report suite will only accept hits that have a manual timestamp send with the hits

Timestamp not allowed: the report suite will only accept hits that do not have any manual timestamp in the hits. If a manual timestamp is present the hit will be filtered out from reporting

Timestamp optional: both manually timestamped hits and non-timestamped hits will be accepted.

To check your report suite settings got to Admin > Report Suites > Edit Settings > General > Timestamp Configuration

At present it is necessary to be really careful with timestamp optional as explained here

This official doc for:

Sequential Data requirements

HTTP 1.1

 

XML encoding and Supported XML tags

XML data sent to the data insertion API must be in UTF-8 and the special XML characters need to be replaced with entities. Some examples

You can find all supported XML tags here

curl example

HTTP 1.0

curl -X POST -A "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.112 Safari/534.30" -H "Content-Type: text/xml" --http1.0 -v -d @event.xml http://alexis.d1.sc.omtrdc.net/b/ss//6

HTTP 1.1

curl -X POST -A "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.112 Safari/534.30" -H "Content-Type: text/xml" --http1.1 -v -d @event.xml http://alexis.d1.sc.omtrdc.net/b/ss//6

Event.xml file

<?xml version=1.0 encoding=UTF-8?>
<request>
    <sc_xml_ver>1.0</sc_xml_ver>
    <events>event5</events>
    <pageURL>testVideo.html</pageURL>
    <pageName>Video CURL</pageName>
    <visitorID>videoUSERID1</visitorID>
    <contextData>
        <a>
            <contentType>Video API</contentType>
            <media>
                <channel></channel>
                <name>VIDEO API</name>
                <playerName>VIDEO API Player</playerName>
                <length>96.711111</length>
                <timePlayed>23</timePlayed>
                <segmentNum>4</segmentNum>
                <segment>M:75-100-API</segment>
                <segmentView>true</segmentView>
                <complete>true</complete>
            </media>
        </a>
    </contextData>
    <linkType>m_i</linkType>
    <timestamp>1432642867</timestamp> >
    <reportSuiteID>lscsalexisandrdoidvideotest</reportSuiteID>
</request>

Notes:

  • Always specify a valid User-Agent.
  • Never use the default one of CURL
  • Always specify a pageName and pageURL
  • Checkthe timestamp settings of report suite
  • Check which Visitor ID needs to be used

Check the following documentation for POST response codes

Za ta izdelek je bila izdana neprenosljiva licenca za priznanje avtorstva, nekomercialno uporabo in skupno rabo pod enakimi pogoji 3.0  Objav v storitvah Twitter™ in Facebook ne urejajo pogoji pogodbe Creative Commons.

Pravna obvestila   |   Pravilnik o zasebnosti v spletu