How to track the amount of time between two different Adobe analytics events

In order to track the amount of time between two different events you can use the getTimeBetweenEvents plugin. It allows you to track the amount of time between two different Adobe analytics events.

I believe this plugin is not free , to get this you need to get in touch to Adobe Consulting.

In case you are not willing to work with Adobe Consulting then you can develop your own custom solution.

You can set a cookie when the first event is fired, in that cookie set the time stamp as t1 and when the second event fire set the timestamp as t2. Calculate the time difference between t1 and t2 and populate the value analytics variable.

Uploading Data through data source using Adobe Analytics API 1.4

This is to test that what happen to data sources FTP location when data source data is uploaded through API 1.4 using postman

1.Create the data source through Analytics UI

  • Login to SC 15
  • Click on Admin->Data Sources

2.Create Transaction ID data sources

3.Using Postman send POST request on https://api.omniture.com/admin/1.4/rest/?method=DataSources.UploadData

4.In Pre-request Script

var uuid = function() {};

uuid.v4 = function() {

    return ‘xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx’.replace(/[xy]/g, function(c) { var r = Math.random()*16|0, v = c == ‘x’ ? r : (r&0x3|0x8); return v.toString(16); });

};

var WSSE = function(username, secret) {

    this.username = username;

    this.secret = secret;

};

WSSE.prototype.getHeader = function() {

    var nonce = uuid.v4();

    var created = new Date().toISOString();

    var hashString = nonce + created + this.secret;

    var digest = CryptoJS.SHA256(hashString).toString(CryptoJS.enc.Base64);

    var b64nonce = CryptoJS.enc.Latin1.parse(nonce).toString(CryptoJS.enc.Base64);

    var header = “UsernameToken”;

    header += ” Username=\”” + this.username + “\”,”;

    header += ” PasswordDigest=\”” + digest + “\”,”;

    header += ” Nonce=\”” + b64nonce + “\”,”;

    header += ” Created=\”” + created + “\”,”;

    header += ” Algorithm=\”SHA256\””;

    return { ‘X-WSSE’: header };

};

var wsse = new WSSE(‘shared secret’, ‘password’);

postman.setEnvironmentVariable(“x-wsse”, wsse.getHeader()[‘X-WSSE’])

5.Under body

{

  “columns”: [

     “Date”,

        “Product”,

         “Orders”,

         “transactionID”

  ],

  “dataSourceID”: “2”,

  “jobName”: “Product returned”,

¬† “reportSuiteID”: “lscsgeekourpc”,

  “rows”: [

    [

      “01/11/2019/06/00/00”,

      “Shirt”,

      “1”,

      “1235”

    ]

  ]

}

6.Under Header set WSSE


Result:

For API 1.4 documentation check : https://github.com/AdobeDocs/analytics-1.4-apis

Note :Grab the data source ID from the URL when you open the data source in UI

Once it appears true as result than in FTP of Data source a SOAP folder is created which have a file of data source, later on, which process.

Processing pauses if the size exceeds 50 MB and does not resume until the total is below 50 MB. To limit delays in generating reports, do not upload more than 90 days of data per day.

Reference : https://marketing.adobe.com/resources/help/en_US/sc/datasources/datasrc_faq.html

Product String in Adobe Launch

If you have single product to pass then you can use the extension in Launch but if you have multiple products then don’t use the extension in Launch.

Use custom code option in Rule of Launch ,sample code is shown below:

for (i = 0; i < digitalData.transaction.item.length; i++)

{

var sku = digitalData.transaction.item[i].productInfo.sku;

var units = digitalData.transaction.item[i].productInfo.units;

var price = digitalData.transaction.item[i].productInfo.checkoutPrice;

var test=test+”;” + sku + “;” + units + “;” + price + “;,”;

}

s.products=test.substring(0,test.length-1);

Do the changes in code as per your requirement.

How to Capture multiple query parameters in the s.util.getQueryparam

Requirement : Want to capture the multiple query parameters in s.campaign variable of Adobe Analytics.

URL:www.example.com?cmpid=hhhh&source=ssss&medium=dddd

Use the following code:

s.campaign = s.Util.getQueryParam(‘cmpid’)+”:”+s.Util.getQueryParam(‘source’)+”:”+s.Util.getQueryParam (‘medium’);

Result: s.campaign =hhhh:ssss:dddd

Automation Software Zapier & IFTTT

Zapier is automation software allowing one business app to speak to another app,it is very similar to product called IFTTT,which is little more open-sourced but this is more business focused.It allows to take repeating tasks and automate them even across different applications.It can be an enormous time-saver.IFTTT is free and Zapier has paid model.

Code To Upload File on FTP Using Python Script

Recently I was working on a project and wanted to upload a file on FTP using Python.

import ftplib
from ftplib import FTP

File2Send = ‘file path’
#To upload file in root directory of FTP location
Output_Directory = “”

ftp = FTP(“ftp.ourpcgeek.com”)
ftp.login(‘user’,’password’)
file = open(File2Send, “rb”)
ftp.cwd(Output_Directory)
ftp.storbinary(‘STOR ‘ + File2Send, file)
print (“STORing File now…”)
ftp.quit()
file.close()
print(“Processign end”)

Following is the code snippet which you can use in case you want to upload file on FTP using Python script:

import ftplib

from ftplib import FTP

File2Send = ‘C:\\Users\\shamshul\\Pictures\\Saved Pictures\\test1.txt’

Output_Directory = “/upload”

   ftp = FTP(“ftp.ourpcgeek.com”)

   ftp.login(‘shamshul’,’wfv2l2Fd’)

   file = open(File2Send, “rb”)

   ftp.cwd(Output_Directory)

   ftp.storbinary(‘STOR ‘ + File2Send, file)

   print (“STORing File now…”)

   ftp.quit()

   file.close()

How to track survey score through Adobe Analytics?

Almost all the companies have surveyed and want to keep track of it for the holistic view of customer satisfaction.

In a survey the possible outcome of a score that can be any of the following numbers- 0,1,2,3,4,5,6,7,8,9,10

The business question can be that what is the best way to capture this score to then be able to calculate the average score through Adobe Analytics.

In Adobe Analytics there is no predefined formula that it can be implemented.

While solving this business problem I came up with two methods.

Method 1:

Step 1 : Take an eVar with the following setting

Step 2: Take an event with the following settings

Step 3: Create a calculate metric

Final Report:

Method 2:

  1. Take an eVar which capture the score
  2. Take counter event which captures the score
  3. Take numeric event to capture the score in the numeric format
  4. Create a calculated metric with the following settings.

 

Final Report:

Please let me know if you have any doubt through comment section, will be happy to reply on it.

Why segment is missing in Data Connector?

Data Connector is formerly known as Genesis. Adobe Data Connectors provide a complete development ecosystem to help Data Connectors partners integrate their products and services into the Adobe Experience Cloud.

Segment created in Adobe Analytics can be reused in Data Connector as Remarketing Segment.
Sometimes the segment is not available in Data Connector. There can be multiple reasons for it like

1. Data Connector owner does not have access to segment
2.The segment is not shared to owner

The major point often get missed, is the compatibility.If the segment is not compatible to Data Warehouse then it will not be available under Data Connector for re-marketing segment.