Expand my Community achievements bar.

Join us January 15th for an AMA with Champion Achaia Walton, who will be talking about her article on Event-Based Reporting and Measuring Content Groups!
SOLVED

Adobe analytics javascript implementation: issue with appmeasurement.js

Avatar

Level 1

Abode Analytics Javascript Library AppMeasurement.js 2.12  is being used for Adobe Plugin development. We came across an error with 2.12 version of AppMeasurement.js – “Uncaught TypeError: Cannot read property 'ac' of undefined". On analysis we could find that, with 2.12.0’s AppMeasurement.js, AppMeasurement instance  doesn’t exist for window object.  This issue could only be resolved by modified the code mentioned as -  “DO NOT ALTER ANYTHING BELOW THIS LINE”.

We are importing AppMeasurement.js into the JavaScript file. The error mentioned occurs only if we are importing the AppMeasurement.js to our JavaScript file and is not there if we are adding it through a script tag in the html file where the  JavaScript file is used (as suggested in Adobe Analytics sample code).

This error is not seen with 1.5.1 version of Adobe Analyics AppMeasurement.js.

Error details:

AppMeasurement instance is null

function AppMeasurement(r){var a=this;a.version="2.12.0";var k=window;k.s_c_in||(k.s_c_il=[],k.s_c_in=0);a._il=k.s_c_il;a._in=k.s_c_in;a._il[a._in]=a;k.s_c_in++;a._c="s_c";varq=k.AppMeasurement.ac;q||(q=null);var p=k,m,s;try{for(m=p.parent,s=p.location;m&&m.location&&s&&""+m.location!=""+s&&p.location&&""+m.location!=""+p.location&&m.location.host==s.host;)p=m,m=p.pare

Workaround:

function AppMeasurement(r){var a=this;a.version="2.12.0";window.AppMeasurement=AppMeasurement;var

However for our purpose, we would need to import  AppMeasurment.js to our  JavaScript file without adding script tags in html.  So could you please help us with some other alternate solution for this issue as we dont want to edit the line which is clearly mentioned as “DO NOT ALTER ANYTHING BELOW THIS LINE

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

The best method to implement Analytics is via Experience Platform Launch. If you're able to do that, I'd highly recommend it.

The 'do not alter anything below this line' code is core stuff that shouldn't have a reason to be touched. However if you have a specific use case to edit, the Adobe police aren't going to hunt you down.

Just keep in mind that if you do touch the code, you're on your own when it comes to troubleshooting and support issues around your implementation.

View solution in original post

2 Replies

Avatar

Correct answer by
Employee Advisor

The best method to implement Analytics is via Experience Platform Launch. If you're able to do that, I'd highly recommend it.

The 'do not alter anything below this line' code is core stuff that shouldn't have a reason to be touched. However if you have a specific use case to edit, the Adobe police aren't going to hunt you down.

Just keep in mind that if you do touch the code, you're on your own when it comes to troubleshooting and support issues around your implementation.

Avatar

Level 1

Gizalle,

I've encountered the same issue migrating from AppMeasurement 2.3.0 to 2.15.0, I didn't touch the AppMeasurement code at all, I performed a simply replacement of 2.3.0 for 2.15.0. Unfortunately I cannot use Launch due to the Analytics Architecture of my company.

My company will buy the Adobe pack for AEM, and we want to have the latest 2.15.0 version

Is there a turn around for this? otherwise I'll stay with the old 2.3.0 but I'm not sure if this will cause issues with the AEM integration.

Best Regards

Elias