I am currently trying to track page views in a virtual type DOM where when a link is clicked on a page I am simply loading the content of the page instead of actually navigating to it (URL does not change). I have been successful in tracking that "link click" as a pageview when sending to a single GA account but it seems like as soon as I add the second account that I need to send the same data to, the pageview tracking gets spotty and becomes hard to replicate what circumstances lead to successfully sending the pageviews to both accounts. I have a GA debugger installed on my browser and it always says that it sent the page view to both accounts based on the different tracking ID's but when I look at the realtime data, it does not always reflect this.
Every now and then I get a warning that says:
Ignoring create request for duplicate tracking name.
I'm not sure if this is something I should just ignore or if it is the root of my problem. Here is the code that I am using to modify and track the pageviews for both accounts. Does anyone see anything glaring that would make my results in GA so inconsistent? Thanks so much!
callGAtracking = function(type, parent, selections, relPath, title, pageURL) {
// First Account Tracking
ga('create', 'UA-XXXXX-Y', 'auto', {name: "firstAnalytics"});
// Second Account Tracking
ga('create', 'UA-XXXXX-Z', 'auto', {name: "secondAnalytics"});
// Click path tracking
ga('firstAnalytics.send', 'event', type + ' - ' + parent, selections.join(' / '), 'article-click');
ga('secondAnalytics.send', 'event', type + ' - ' + parent, selections.join(' / '), 'article-click');
// Set pageview info for selected article
ga('firstAnalytics.set', 'page', relPath);
ga('secondAnalytics.set', 'page', relPath);
ga('firstAnalytics.set', 'title', title);
ga('secondAnalytics.set', 'title', title);
ga('firstAnalytics.set', 'location', pageURL);
ga('secondAnalytics.set', 'location', pageURL);
// Send pageview
ga('firstAnalytics.send', 'pageview');
ga('secondAnalytics.send', 'pageview');
}