Upgrading Adobe AppMesurement and Adobe VisitorAPI from version 1.6 to 2.5

Silver Contributor
Silver Contributor

Hi I'm currently using version 1.6 Appmeasurement and VisitorApi of Adobe Analytics and wanted to upgraded to the latest version which is 2.5 however i notice that the Visitor Api is different from the previous one.

 

on our metrics.js declaring visitor like this

w.Visitor = Visitor;

this the code snippet from VisitorApi 1.6

/*
 ============== DO NOT ALTER ANYTHING BELOW THIS LINE ! ============

 Adobe Visitor API for JavaScript version: 1.6.0
 Copyright 1996-2015 Adobe, Inc. All Rights Reserved
 More info available at http://www.omniture.com
*/
var A = !0,
  B = !1;

function Visitor(o, t) {
  if (!o) throw "Visitor requires Adobe Marketing Cloud Org ID";
  var a = this;
  a.version = "1.6.0";
  var m = window,
    i = m.Visitor;
  i.version = a.version;

and this is the codebase for the current one

! function e(t, i, n) {
  function r(s, o) { if (!i[s]) { if (!t[s]) { var l = "function" == typeof require && require; if (!o && l) return l(s, !0); if (a) return a(s, !0); var u = new Error("Cannot find module '" + s + "'"); throw u.code = "MODULE_NOT_FOUND", u } var c = i[s] = { exports: {} };
      t[s][0].call(c.exports, function(e) { var i = t[s][1][e]; return r(i || e) }, c, c.exports, e, t, i, n) } return i[s].exports } for (var a = "function" == typeof require && require, s = 0; s < n.length; s++) r(n[s]); return r }({
  1: [function(e, t, i) {
    (function(i) { e("./utils/polyfills"); var n = e("./strategies/LocalVisitor"),
        r = e("./strategies/ProxyVisitor"),
        a = e("./strategies/PlaceholderVisitor"),
        s = e("./utils/callbackRegistryFactory"),
        o = e("./Message"),
        l = e("./enums"),
        u = l.MESSAGES;
      t.exports = function(e, t, l, c) {
        function d(e) { Object.assign(D, e) }

        function f(e) { Object.assign(D.state, e), D.callbackRegistry.executeAll(D.state) }

        function g(e) { if (!A.isInvalid(e)) { v = !1; var t = A.parse(e);
            D.setStateAndPublish(t.state) } }

        function _(e) {!v && I && (v = !0, A.send(c, e)) }

        function p() { d(new n(l._generateID)), D.getMarketingCloudVisitorID(), D.callbackRegistry.executeAll(D.state, !0), i.removeEventListener("message", m) }

        function m(e) { if (!A.isInvalid(e)) { var t = A.parse(e);
            v = !1, i.clearTimeout(this.timeout), i.removeEventListener("message", m), d(new r(D)), i.addEventListener("message", g), D.setStateAndPublish(t.state), D.callbackRegistry.hasCallbacks() && _(u.GETSTATE) } }

        function h() { I && postMessage ? (i.addEventListener("message", m), _(u.HANDSHAKE), this.timeout = setTimeout(p, 250)) : p() }

        function C() { i.s_c_in || (i.s_c_il = [], i.s_c_in = 0), D._c = "Visitor", D._il = i.s_c_il, D._in = i.s_c_in, D._il[D._in] = D, i.s_c_in++ }

        function S() {
          function e(e) { 0 !== e.indexOf("_") && "function" == typeof l[e] && (D[e] = function() {}) } Object.keys(l).forEach(e), D.getSupplementalDataID = l.getSupplementalDataID } var D = this,
          I = t.whitelistParentDomain;
        D.state = {}, D.version = l.version, D.marketingCloudOrgID = e; var v = !1,
          A = new o(e, I);
        D.callbackRegistry = s(), D.findField = function(e, t) { if (D.state[e]) return t(D.state[e]), D.state[e] }, D.messageParent = _, D.setStateAndPublish = f,
          function() { C(), S(), d(new a(D)), h() }() } }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}) }, { "./Message": 2, "./enums": 4, "./strategies/LocalVisitor": 5, "./strategies/PlaceholderVisitor": 6, "./strategies/ProxyVisitor": 7, "./utils/callbackRegistryFactory": 9, "./utils/polyfills": 11 }],
  2: [function(e, t, i) { var n = e("./enums"),
      r = n.MESSAGES,
      a = { 0: "prefix", 1: "orgID", 2: "state" };
    t.exports = function(e, t) { this.parse = function(e) { try { var t = {}; return e.data.split("|").forEach(function(e, i) { if (void 0 !== e) { t[a[i]] = 2 !== i ? e : JSON.parse(e) } }), t } catch (e) {} }, this.isInvalid = function(i) { var n = this.parse(i); if (!n || Object.keys(n).length < 2) return !0; var a = e !== n.orgID,
          s = !t || i.origin !== t,
          o = -1 === Object.keys(r).indexOf(n.prefix); return a || s || o }, this.send = function(i, n, r) { var a = n + "|" + e;
        r && r === Object(r) && (a += "|" + JSON.stringify(r)); try { i.postMessage(a, t) } catch (e) {} } } }, { "./enums": 4 }],
  3: [function(e, t, i) {
    (function(i) {
      function n() {
        function e() { l.windowLoaded = !0 } i.addEventListener ? i.addEventListener("load", e) : i.attachEvent && i.attachEvent("onload", e), l.codeLoadEnd = (new Date).getTime() }
      /** @license ============== DO NOT ALTER ANYTHING BELOW THIS LINE ! ============

      Adobe Visitor API for JavaScript version: 2.5.0
      Copyright 1996-2015 Adobe, Inc. All Rights Reserved
      More info available at https://marketing.adobe.com/resources/help/en_US/mcvid/

Is there a way for me to upgrade smoothly with our existing implementation on our metrics.js? appreaciate any help from this community. FYI im getting some errors 

7 REPLIES 7

Upgrading Adobe AppMesurement and Adobe VisitorAPI from version 1.6 to 2.5

Gold Contributor
Gold Contributor

Hi @PansensoyI. The first thing to check is to make sure the visitor api code is inserted before appmeasurment.

If this is done than also check if you are getting the correct instance of the visitor api. eg.
var visitor = Visitor.getInstance("016D5C175213CCA80A490D13@AdobeOrg")
This makes sure that you are using the correct instance of the visitor object created by the script.

If you type 's_c_il' in the developer console (without the quotes) you'll get an array of all the 'parts' that are instanciated.


Hopefully this helps you in finding the solution for your problem

Upgrading Adobe AppMesurement and Adobe VisitorAPI from version 1.6 to 2.5

Tealium Employee

 Hi @PansensoyI

 

If you are using the latest Marketplace versions of the Adobe Analytics AppMeasurement for JS and Adobe Marketing Cloud ID Service (Adobe VisitorAPI) tags then it isn't too hard to upgrade these to the latest versions from Adobe.

For the AppMeasurement tag:

  1. Download the latest version from: https://sc2.omniture.com/p/appmeasurement/current/GetComponent.html?platform=js&component=AppMeasure... 
  2. Expand the zip file
  3. Open the AppMeasurement.js file
  4. Copy the contents from ============== DO NOT ALTER ANYTHING BELOW THIS LINE ! =============== 
  5. In the template replace the same part until the comment // End AppMeasurement

For the Adobe VisitorAPI tag:

  1. From the same zip file grab the contents from VisitorAPI.js
  2. Paste this into the template at the top replacing the current Adobe library code.

 

 You will need to verify this works, and there are no issues with compatibility with the templates and the latest Adobe libraries.

 

Adrian

 

Ask me anything Tealium related or TypeScript/JavaScript, or NodeJS.
Please remember to mark solutions as accepted for future searchers.

Upgrading Adobe AppMesurement and Adobe VisitorAPI from version 1.6 to 2.5

Silver Contributor
Silver Contributor

hi @adrian_browning and @jan_van_damme. already deployed this to prod however im getting error report suite id missing but beacons is firing. you can check it in news.com.au

Upgrading Adobe AppMesurement and Adobe VisitorAPI from version 1.6 to 2.5

Tealium Employee

@PansensoyI

 

I've just taken a look and I can't see the error you are referring to being logged anywhere.

From memory, this happens when s_gi() is not called with a report suite.

 

Adrian

Ask me anything Tealium related or TypeScript/JavaScript, or NodeJS.
Please remember to mark solutions as accepted for future searchers.

Upgrading Adobe AppMesurement and Adobe VisitorAPI from version 1.6 to 2.5

Silver Contributor
Silver Contributor

Hi Adrian

take a look at this article http://www.news.com.au/technology/science/tv-scientist-offers-outthere-solution-to-australias-energy... . As i observe it usually happen if articles has videos in it. The way i instantiated my appMeasurement is this

var rsid = accounts.join(',');
metrics.s = s = new AppMeasurement(rsid);

Upgrading Adobe AppMesurement and Adobe VisitorAPI from version 1.6 to 2.5

Tealium Employee

Hi @PansensoyI

 

So looks like it is the video player that is causing the issue.

The file http://resources.newscdn.com.au/cs/video/vjs/stable/build/videojs.plugins.min.js is being loaded and called and has a line of code:

 

 appMeasurement = new AppMeasurement;

 

Which isn't passing in any report suite. If you update that file then the error with be fixed.

 

Adrian 

Ask me anything Tealium related or TypeScript/JavaScript, or NodeJS.
Please remember to mark solutions as accepted for future searchers.

Upgrading Adobe AppMesurement and Adobe VisitorAPI from version 1.6 to 2.5

Silver Contributor
Silver Contributor

Thanks that fixed it

Public