Can anyone please help me with appMeasurement.js code?

Avatar

Avatar

nadeema90078524

Avatar

nadeema90078524

nadeema90078524

19-06-2017

Hi,

I am trying to integrate a AAM with AA through DTM. Can anyone please help me with appMeasurement.js code?

1. I started with creating a property in DTM. Added AA and Marketing cloud as tool. And used the footer and header in HTML page.

2. Next, I created a report suit in AA and mentioned that in DTM.

3. Added tracking server to both the tools.

4. Lastly added the following appMeasurement.js code in the editor of AA tool. :

var s = new AppMeasurement();

s.account = "ctsptnrctsptnramcpoc2";

var s_account=s.account

/*

Start ActivityMap Module

The following module enables ActivityMap tracking in Adobe Analytics. ActivityMap

allows you to view data overlays on your links and content to understand how

users engage with your web site. If you do not intend to use ActivityMap, you

can remove the following block of code from your AppMeasurement.js file.

Additional documentation on how to configure ActivityMap is available at:

https://marketing.adobe.com/resources/help/en_US/analytics/activitymap/getting-started-admins.html

*/

function AppMeasurement_Module_ActivityMap(f){function g(a,d){var b,c,n;if(a&&d&&(b=e.c[d]||(e.c[d]=d.split(","))))for(n=0;n<b.length&&(c=b[n++]);)if(-1<a.indexOf(c))return null;p=1;return a}function q(a,d,b,c,e){var g,h;if(a.dataset&&(h=a.dataset[d]))g=h;else if(a.getAttribute)if(h=a.getAttribute("data-"+b))g=h;else if(h=a.getAttribute(b))g=h;if(!g&&f.useForcedLinkTracking&&e&&(g="",d=a.onclick?""+a.onclick:"")){b=d.indexOf(c);var l,k;if(0<=b){for(b+=10;b<d.length&&0<="= \t\r\n".indexOf(d.charAt(b));)b++;

if(b<d.length){h=b;for(l=k=0;h<d.length&&(";"!=d.charAt(h)||l);)l?d.charAt(h)!=l||k?k="\\"==d.charAt(h)?!k:0:l=0:(l=d.charAt(h),'"'!=l&&"'"!=l&&(l=0)),h++;if(d=d.substring(b,h))a.e=new Function("s","var e;try{s.w."+c+"="+d+"}catch(e){}"),a.e(f)}}}return g||e&&f.w[c]}function r(a,d,b){var c;return(c=e[d](a,b))&&(p?(p=0,c):g(k(c),e[d+"Exclusions"]))}function s(a,d,b){var c;if(a&&!(1===(c=a.nodeType)&&(c=a.nodeName)&&(c=c.toUpperCase())&&t[c])&&(1===a.nodeType&&(c=a.nodeValue)&&(d[d.length]=c),b.a||

b.t||b.s||!a.getAttribute||((c=a.getAttribute("alt"))?b.a=c:(c=a.getAttribute("title"))?b.t=c:"IMG"==(""+a.nodeName).toUpperCase()&&(c=a.getAttribute("src")||a.src)&&(b.s=c)),(c=a.childNodes)&&c.length))for(a=0;a<c.length;a++)s(c[a],d,b)}function k(a){if(null==a||void 0==a)return a;try{return a.replace(RegExp("^[\\s\\n\\f\\r\\t\t-\r \u00a0\u1680\u180e\u2000-\u200a\u2028\u2029\u205f\u3000\ufeff]+","mg"),"").replace(RegExp("[\\s\\n\\f\\r\\t\t-\r \u00a0\u1680\u180e\u2000-\u200a\u2028\u2029\u205f\u3000\ufeff]+$",

"mg"),"").replace(RegExp("[\\s\\n\\f\\r\\t\t-\r \u00a0\u1680\u180e\u2000-\u200a\u2028\u2029\u205f\u3000\ufeff]{1,}","mg")," ").substring(0,254)}catch(d){}}var e=this;e.s=f;var m=window;m.s_c_in||(m.s_c_il=[],m.s_c_in=0);e._il=m.s_c_il;e._in=m.s_c_in;e._il[e._in]=e;m.s_c_in++;e._c="s_m";e.c={};var p=0,t={SCRIPT:1,STYLE:1,LINK:1,CANVAS:1};e._g=function(){var a,d,b,c=f.contextData,e=f.linkObject;(a=f.pageName||f.pageURL)&&(d=r(e,"link",f.linkName))&&(b=r(e,"region"))&&(c["a.activitymap.page"]=a.substring(0,

255),c["a.activitymap.link"]=128<d.length?d.substring(0,128):d,c["a.activitymap.region"]=127<b.length?b.substring(0,127):b,c["a.activitymap.pageIDType"]=f.pageName?1:0)};e.link=function(a,d){var b;if(d)b=g(k(d),e.linkExclusions);else if((b=a)&&!(b=q(a,"sObjectId","s-object-id","s_objectID",1))){var c,f;(f=g(k(a.innerText||a.textContent),e.linkExclusions))||(s(a,c=[],b={a:void 0,t:void 0,s:void 0}),(f=g(k(c.join(""))))||(f=g(k(b.a?b.a:b.t?b.t:b.s?b.s:void 0)))||!(c=(c=a.tagName)&&c.toUpperCase?c.toUpperCase():

"")||("INPUT"==c||"SUBMIT"==c&&a.value?f=g(k(a.value)):"IMAGE"==c&&a.src&&(f=g(k(a.src)))));b=f}return b};e.region=function(a){for(var d,b=e.regionIDAttribute||"id";a&&(a=a.parentNode);){if(d=q(a,b,b,b))return d;if("BODY"==a.nodeName)return"BODY"}}}

/* End ActivityMap Module */

s.loadModule("AudienceManagement");

/*included 'AppMeasurement_Module_AudienceManagement.js' code*/

function s_doPlugins(s) {

/*User CRM ID - example of it getting set in eVar1*/

    s.eVar3="123456789";

   

//Import the ID service server package

//var Visitor = require("@adobe-mcid/visitor-js-server");

var visitor = Visitor.getInstance ("Marketing org Id",{});// CUSTOMER ORG ID

s.visitor = visitor;

s.visitor.setCustomerIDs({

    "dtm_amc":{

        "id":"123456789",

        "authState":Visitor.AuthState.AUTHENTICATED

    }

});

//Pass in your Organization ID to instantiate Visitor

//var visitor = new Visitor("Marketing org Id");

//Replace DIL with the Audience Manager Module

  s.AudienceManagement.setup({

             "partner":"partner name",

             "containerNSID":0,

             "uuidCookie": { //optional if you want to set the UUID in the first-party domain

                "name":"aam_uuid",

                "days": 30

            }

        });

}

s.doPlugins=s_doPlugins;

s.trackingServer = "Tracking server name";

/*rest is 'AppMeasurement.js' code*/

Can anyone tell me :

1. What is the problem with my code? UUID is not generating.

2. How to check if AAM is being integrated with AA?

3. It has been asked to remove DIL code from the appMeasurement js. What is that part which we have to remove?

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

Varun_Kalra

MVP

Avatar

Varun_Kalra

MVP

Varun_Kalra
MVP

21-06-2017

Hi there,

It seems that you have AA, AAM and Marketing Cloud Service and you want to implement AAM.

Which approach would you like to use Server Side Forwarding or Client side forwarding ? Audience Management module is to be used when you want to implement AAM via Server Side Forwarding. That needs to be enabled by AAM client care first for your AA tracking servers.

Please check this article for more info : How to implement Adobe Audience Manager?

Thanks,

Varun

Answers (2)

Answers (2)

Avatar

Avatar

Gaurang

Community Manager

Avatar

Gaurang

Community Manager

Gaurang
Community Manager

04-07-2017

Hi,

Did you get a solution to your query? if yes, can you mark a reply as the correct answer. Marking an answer as correct helps other community users as well.

Thanks!

Avatar

Avatar

Linda_Stinson

Employee

Avatar

Linda_Stinson

Employee

Linda_Stinson
Employee

20-06-2017

Can you email me the url of your web-site?

Linda