A4T and Server-side Digital Marketing

28 Jul 2019 » Server Side

In a client-side implementation, the JavaScript code takes care of Analytics for Target (A4T), so you do not have to do anything. However and as usual, in any server-side or hybrid implementation of Analytics and Target, A4T requires some additional care.

If you want a quick review, I suggest you go to my old post about A4T. The concepts are still valid and now Adobe has also a help section about it. However, that post only covers a client-side implementation, where JavaScript takes care care of everything. In this post I will cover the server-side part.

First page of first visit

I know I am repeating myself a lot, but the very first page of a visitor is a special case. If you have been following my series of posts on hybrid implementation, you will know that you must always execute the ECID client-side and Target should also be executed client-side on the first page of the first visit. In the post about hybrid Target, I suggested injecting some JavaScript code only on this first page, to deal with Target. If, on this first page, you also implement Analytics client-side, you do not have to do anything. It works exactly as a typical client-side implementation with the SDID.

However, I also explained some alternative methods for hybrid Analytics. One of them was to make a call to the server and keep all Analytics implementations server-side. In this case, you need to get the SDID from the ECID service using visitor.getSupplementalDataID() and send it to the server in the call. Then, in the Analytics call, you need to add the sdid parameter with this value. I must admit I have never tried this option.

Second page onwards

The fun starts when you switch to pure server-side. As documented in A4T for Batch Delivery API, the response of the Target API call may include a parameter named clientSideAnalyticsLoggingPayload. This is how it looks like in one of the examples I created for the Adobe Summit 2019:

{
    "requestId": "8de76969-43aa-4cc5-9cef-3d4bc4fd9563",
    "client": "adobeinternalags059",
    "id": {
        "tntId": "111563876083943-241656.17_205",
        "marketingCloudVisitorId": "54391027238025398792818300718840429742"
    },
    "edgeHost": "mboxedge17.tt.omtrdc.net",
    "contentAsJson": false,
    "mboxResponses": [
        {
            "mbox": "ps2-80-hero-banner",
            "parameters": {
                "lab_user": "PS2-80",
                "at_property": "3eecbf19-98b1-0670-248e-22c9c9f2af71"
            },
            "content": "<img src=\"style\/emea-summit.jpg\" \/>",
            "clientSideAnalyticsLoggingPayload": {
                "pe": "tnt",
                "tnta": "281281:1:0|0,281281:1:0|2,281281:1:0|1"
            }
        }
    ]
}

The official documentation then tells you to make an empty Analytics call with just the tnta parameter above. However, this will cost you an extra server call. Instead, I recommend that you add the tnta parameter to the Analytics call you would do anyway at the bottom of the page. Do not forget to URL-encode it. Following the previous example, this is the call made by my code (formatted for better reading):

http://ags059.sc.omtrdc.net/b/ss/ags059summit2019/0?
AQB=1&
ndh=0&
mid=54391027238025398792818300718840429742&
aamb=j8Odv6LonN4r3an7LhD3WZrU1bUpAkFkkiY1ncBR96t2PTI&
aamlh=6&mcorgid=2A19A77B5658600F7F000101%40AdobeOrg&
ce=UTF-8&
pageName=PM%20-%20Home%20page&
g=http%3A%2F%2Fadobe.pedromonjo.com%2Femea-summit-2019%2Findex.php&
v1=PM%20-%20Home%20page&
c1=http%3A%2F%2Fadobe.pedromonjo.com%2Femea-summit-2019%2Findex.php&
c2=Server-side&
events=event1&
tnta=281281%3A1%3A0%7C0%2C281281%3A1%3A0%7C2%2C281281%3A1%3A0%7C1&
AQE=1

You will notice that the Analytics mid parameter is the same as the Target marketingCloudVisitorId.

A4T or not

I assume you have already provisioned A4T. However, you still need to configure the activities in the Target UI to use A4T. In order to do this, you must select “Adobe Analytics” as “Reporting Source” in the”Goals & Settings” page of the activity:

It goes without saying that you need to configure everything else correctly on that page.

Finally, since you can still configure Target as the reporting source, your code must accept both cases:

  • Reporting in Target: no clientSideAnalyticsLoggingPayload in the Target response and no setting of the tnta parameter in the Analytics calls.
  • Reporting in Analytics (aka A4T): clientSideAnalyticsLoggingPayload present in the Target response and its value copied over to the tnta parameter in the Analytics calls.

 

illustration by Ouch.pics



Related Posts