Adobe analytics javascript implementation: issue with appmeasurement.js

Avatar

Avatar
Validate 1
Level 1
bci85742528
Level 1

Likes

0 likes

Total Posts

1 post

Correct reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
bci85742528
Level 1

Likes

0 likes

Total Posts

1 post

Correct reply

0 solutions
Top badges earned
Validate 1
View profile
bci85742528
Level 1

04-04-2019

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

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Coach
Employee
Gigazelle
Employee

Likes

473 likes

Total Posts

1,947 posts

Correct reply

740 solutions
Top badges earned
Coach
Contributor 2
Validate 1
Ignite 80
Ignite 70
View profile

Avatar
Coach
Employee
Gigazelle
Employee

Likes

473 likes

Total Posts

1,947 posts

Correct reply

740 solutions
Top badges earned
Coach
Contributor 2
Validate 1
Ignite 80
Ignite 70
View profile
Gigazelle
Employee

26-04-2019

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.

Answers (1)

Answers (1)

Avatar

Avatar
Level 1
eliasl76266528
Level 1

Likes

0 likes

Total Posts

1 post

Correct reply

0 solutions
View profile

Avatar
Level 1
eliasl76266528
Level 1

Likes

0 likes

Total Posts

1 post

Correct reply

0 solutions
View profile
eliasl76266528
Level 1

07-08-2019

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