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
1.5K members online now
1.5K 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

Cross Domain Tracking - domain1= direct implementation of enhanced GA | domain2= GA by Tag Manager

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Dear community, 

I am an absolute greenhorn in coding. Sorry in advance, if some of my questions are not professional....

We have problems with the implementation of GA cross-domain tracking. 

 

Domain 1: getstamps.ca - using Google Enhanced E-Commerce - Direct implementation of the GA Code without Google Tag Manager (via Shop-Plugin)

Domain 2: getstamps-ca.utypia.com - here we only have access on the source code by Google Tag Manager

 

Domain 1 and 2 are using the same Universal GA Tracking Id. 

 

GA-Code on Domain 1: 

<script>
(function (i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r;
i[r] = i[r] || function () {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date();
a = s.createElement(o),
m = s.getElementsByTagName(o)[0];
a.async = 1;
a.src=g;
m.parentNode.insertBefore(a, m)
})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
ga('create', 'UA-68275242-1', 'auto' ,{ 'allowLinker':true });
ga('require','linker');
ga('linker:autoLink',['getstamps-ca.utypia.com']);
ga('require', 'displayfeatures');
ga('set', 'anonymizeIp', true);
ga('require', 'ec');
ga('set', '&cu', 'CAD');
function googleEnhanceAddToCart(product) {
ga('ec:addProduct', product);
ga('ec:setAction', 'add');
ga('send', 'event', 'UX', 'click', 'add to cart');     // Send data using an event.
}
function googleEnhanceClickOnProduct(product, url) {
ga('ec:setAction', 'click', {list: product.list});
ga('send', 'event', 'UX', 'click', product.list, {
'hitCallback': function () {
document.location = url;
}
});
delete product.list;
ga('ec:addProduct', product);
}
$(document).on("click", ".openArticle", function (e) {
e.preventDefault();
$me = $(this);
googleEnhanceClickOnProduct(articleObj[$me.data("id")], this.href);
});
ga('send', 'pageview');
</script>

Domain 2: 

We have tried different implementation methods on domain 2.

1. On the on hand we used the standard implementation with autolinking according this guideline: 

https://support.google.com/analytics/answer/1034342?hl=de

That didn't work for us. --> Still one user generates two sessions and not one. I think this is a problem due to not using GTM on domain 1 and domain 2.

2. Also we tried the implementation on domain 2 by copying the modified GA Code  in the html field of the google tag manager:

<script>
(function (i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r;
i[r] = i[r] || function () {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date();
a = s.createElement(o),
m = s.getElementsByTagName(o)[0];
a.async = 1;
a.src=g;
m.parentNode.insertBefore(a, m)
})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
ga('create', 'UA-68275242-1', 'auto' ,{ 'allowLinker':true });
ga('require','linker');
ga('linker:autoLink',['getstamps.ca']);
ga('require', 'displayfeatures');
ga('set', 'anonymizeIp', true);
ga('require', 'ec');
ga('set', '&cu', 'CAD');
function googleEnhanceAddToCart(product) {
ga('ec:addProduct', product);
ga('ec:setAction', 'add');
ga('send', 'event', 'UX', 'click', 'add to cart');     // Send data using an event.
}
function googleEnhanceClickOnProduct(product, url) {
ga('ec:setAction', 'click', {list: product.list});
ga('send', 'event', 'UX', 'click', product.list, {
'hitCallback': function () {
document.location = url;
}
});
delete product.list;
ga('ec:addProduct', product);
}
$(document).on("click", ".openArticle", function (e) {
e.preventDefault();
$me = $(this);
googleEnhanceClickOnProduct(articleObj[$me.data("id")], this.href);
});
ga('send', 'pageview');
</script>

Same result --> double tracking and furthermore we get the tag assistant feedback, that the code implementation by GTM hasn't been executed correctly.

 

My Questions - thank you very much in advance for any comments and help:

 

1. Is it generally possible to implement cross-domain-tracking one time by direct implementation (domain1) and one time (domain2)  by GTM?

2. Is it possible not to use the standard implementation of the Universal Code (domain2) by the tag manager, but integrating the GA Code in the html field of the tag manager. As far as I can see, the code delivered by the tag manager on domain 2 differs from the code copied in the html field of the tag manager. 

Example: 

{'allowLinker': true})= HTML field of GTM --> {allowLinker:!0} = delivered code on domain2.

3. Do we also have to modify the code on domain 1 by additional parameters, we haven't identified so far?

4. I would be very happy for any help to solve this problem.....

 

Thanks once again!