Time Campaigns Implementation

Calling the method activeOnlineCampaigns returns the values of the parameters which you set up in Personalisation – Time campaigns regarding the position, local time and other attributes of the current visitor at your website.

p = diffAnalytics.personaliser()
p.activeOnlineCampaigns({}, function(err, value) { console.log(value) })


params
 = (to be specified, currently empty object)
callback = function(err, value) { ... }

The elements of value include current server time and individual active campaigns (as a key) corresponding to setting in Yottly (all timestamps are in UTC timezone). They have the following form:

{
"now": 1506870382930, // current server time

"activeCampaigns": { 
  "campaign 1": {
      "windowValidity": { //validity of the currently valid time window
        "fromParts": {
          "hours": 6,
          "minutes": 30,
          "seconds": 0
        },

        "toParts": {
          "hours": 20,
          "minutes": 45,
          "seconds": 0
        },

        "from": 1506832200000, //validity of the currently valid time window as timestamp for easier handling when creating time countdowns
        "to": 1506883500000
      }
      "campaignValidity": { //validity of the Campaign specified by the key "campaign 1"
        "from": 1505568600000,
        "to": 1507296600000
       },
      "parameters": {
        "foo": "bar",
        "baz": "blam",
        "quux": "frob"
      }
    }
  }
}
Was this article helpful to you? Yes No