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

3rd party cart in iframe and cross domain tracking

Follower ✭ ☆ ☆
# 1
Follower ✭ ☆ ☆

Hi, my issue is as follows

 

  • We use a third party shopping cart that is loaded into an iframe on some of our landing pages (to show availability etc.).
  • Both our main website and the shopping cart use the same tracking id
  • We have setup the auto linker plugin like this:

 

Main website:

 

ga('create', 'UA-xxxxxxxx-1', 'auto', {'allowLinker': true});
ga('require', 'linker'); ga('linker:autoLink', ['aventuras.checkfront.com'] ); ga('send', 'pageview'); ga('require', 'ecommerce');

 

Shopping cart analytics: aventuras.checkfront.com (we don't have control over this, we can only change the tracking id)

 

ga('create', 'UA-xxxxxxxx-1', 'auto', {'allowLinker':true});
ga('require', 'ecommerce', 'ecommerce.js');
ga('send','pageview','/checkfront/reserve/');

 

I assume that in this case analytics is loaded two times and all our conversion are attributed to direct traffic visiting aventuras.checkfront.com instead of the real landingpage. This means we lose the original referrer or campaign information.

 

Secondary problem is that we are probably seeing double pageviews.

 

Any idea how to fix this?

1 Expert replyverified_user

Re: 3rd party cart in iframe and cross domain tracking

Top Contributor
# 2
Top Contributor
Hi :-)
I dont have much experience with iframe tracking however
1) The 3rd party domain needs to be added to the referral exclusion list
and you may also want to take a look at the developer documentation for iframe tracking
as it varies from the usual cross domain tracking due to iframes being on a page before the
tracking code loads
https://developers.google.com/analytics/devguides/collection/analyticsjs/cross-domain#iframes
Bronwyn Vourtis, Google Analytics Top Contributor
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here

Re: 3rd party cart in iframe and cross domain tracking

Follower ✭ ☆ ☆
# 3
Follower ✭ ☆ ☆
Thanks, I`ll look at the link.

We already have added the 3rd party domain to the referral exclusion list, so that can't be the problem.

Do you know if we might need to use two different properties for the main website and the shopping cart loaded in the iframe?

Re: 3rd party cart in iframe and cross domain tracking

Top Contributor
# 4
Top Contributor
hi :-)
same tracking id (property) must be used for cross domain tracking
Bronwyn Vourtis, Google Analytics Top Contributor
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here

Re: 3rd party cart in iframe and cross domain tracking

Follower ✭ ☆ ☆
# 5
Follower ✭ ☆ ☆
Hi Bronwyn,

Thanks, that means that at least my setup is correct. Ás I can't influence the code on the iframe, I've contacted the shopping cart providers to see what we can do to fix this issue.

Any other suggestions are welcome Smiley Happy

Re: 3rd party cart in iframe and cross domain tracking

Visitor ✭ ✭ ✭
# 6
Visitor ✭ ✭ ✭
Hi Auke,

I have the same issue, have you had any more luck getting it to work or a response from Checkfront?

It appears like the second domain being Checkfront, needs to have the linker code directing back to your original domain. So like this:

ga('linker:autoLink', ['YourDomain'] );

But there is no way to add this additional tracking to the Checkfront domain.

This is referenced in the "Bi-directional cross-domain tracking" on this page.
https://developers.google.com/analytics/devguides/collection/analyticsjs/linker

Regards,
Justin

Re: 3rd party cart in iframe and cross domain tracking

Follower ✭ ☆ ☆
# 7
Follower ✭ ☆ ☆
Hi Justin,

I got this reply from Checkfront:

Specifying the autolinker is not a necessary part of the process in connecting the analytics session; when the droplet interface script detects the presence of the ga script on the page, it uses the standard linker decoration to modify the URL of the frame. When it cannot detect the analytics script at the time the script runs, it will load the frame without GA link decoration, and thereby create a new session.

Effectively what this means is that you will just want to ensure that the analytics script is loaded before the droplet script is run — e.g. by loading the analytics script early in the page header, or by otherwise deferring the execution of the droplet script until the analytics script has loaded. In most cases this is already the case, but in others the load may be affected by other events due to how the GA system loads asynchronously.

As an example of waiting for analytics to load before invoking the droplet, the following could potentially work in place of one of your current droplet scripts to allow for the delay:

ga(function() {
new CHECKFRONT.Widget ({
host: 'aventuras.checkfront.com',
target: 'CHECKFRONT_WIDGET_01',
item_id: '35',
category_id: '4',
provider: 'droplet'
}).render();
});

Re: 3rd party cart in iframe and cross domain tracking

Visitor ✭ ✭ ✭
# 8
Visitor ✭ ✭ ✭
Hi Auke,

Thank you for the useful information.

Regards,
Justin