AdWords is now Google Ads. Our new name reflects the full range of advertising options we offer across Search, Display, YouTube, and more. Learn more

Analytics
4.4K members online now
4.4K members online now
Dive into multiple domain (Cross/Sub) tracking, implementing Ecommerce and Enhanced Ecommerce, setting up Event tracking, and Universal Analytics code.
 
Guide Me
star_border
Reply

AnomynizeIP function TypeError

Follower ✭ ☆ ☆
# 1
Follower ✭ ☆ ☆

Hi All,

 

A client of us is using the classic dc.js script and is trying to implement the anomynizeIP function for multiple trackers on a single page. When debugging this implementation, we get the following error: Called method "_anonymizeIp" threw exception.TypeError: Cannot read property 'apply' of undefined. 

 

The first tracker does not give this error, but the second one does. Does this mean that the anonymizeIP function is not applied for the second tracker. The script for the second tracker look like this:

 

-----------------------------------------------------------------------------------------------------------------------------

 

AppSettings.secondaryAnalyticsEnabled = true;
window.disableSpecificStr = 'ga-disable-UA-XXXXXX-1';

if (isAnalyticsDisabled(disableSpecificStr)) {
window[disableSpecificStr] = true;
AppSettings.secondaryAnalyticsEnabled = false;
}

_gaq.push(
['b._setAccount', 'UA-XXXXXX-3'],
['b._gat._anonymizeIp'],
['b._set', 'currencyCode', 'EUR'],
['b._trackPageview']
);

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src=('https:' === document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js';
var s = document.getElementsByTagName('script')[1]; s.parentNode.insertBefore(ga, s);
})();

var dataLayer = [];

 

------------------------------------------------------------------------------------------------------------------------------

 

Any help would be hugely appreciated!

 

Kind regards,

Joost 

AnomynizeIP function TypeError

Visitor ✭ ✭ ✭
# 2
Visitor ✭ ✭ ✭

I'm encountering the same error using the ga.js script for the same multiple trackers implementation:

 

"Called method "_anonymizeIp" threw exception.TypeError: Cannot read property 'apply' of undefined"

 

Exactly the same issue, For the first tracker the implementation works, while on the second it throws the above error.

 

Any suggestions? 

Thanks,

Arthur

Re: AnomynizeIP function TypeError

Follower ✭ ✭ ✭
# 3
Follower ✭ ✭ ✭

@Arthur R wrote:

I'm encountering the same error using the ga.js script for the same multiple trackers implementation:

 

"Called method "_anonymizeIp" threw exception.TypeError: Cannot read property 'apply' of undefined"

 

Exactly the same issue, For the first tracker the implementation works, while on the second it throws the above error.


What is your code?

AnomynizeIP function TypeError

[ Edited ]
Visitor ✭ ✭ ✭
# 4
Visitor ✭ ✭ ✭

Problem Solved! => https://www.screencast.com/t/ftlolXFKD 

 

How to solve it:

1) First, initialize both GA accounts.
2) Then, Initialize the anonymizeIp function without prefixes.
3) After that, you can initialize all other parameters for both GA accounts.

Verification:
Press F12 to go to Developer Tools, choose Network tab, and search for "_utm" click on all iterations, and search for the "aip=1" parameter on both of them to make sure the anonymizeIp catched them all: https://www.screencast.com/t/U6LCAk1XKC

 

I hope this helps.

Arthur