Architheutus
Architheutus

Reputation: 73

Google analytics in iframe content (different domain)

I have been reading some google documentation on tracking via google analytics, but still hasn't have a clear understanding of what's happening, I will put this in plain english so that my query can help others as well.

Basically I have 2 sites: siteA.com (parent), and siteB.com (child)

I have created a widget on siteB.com, i.e. siteB.com/widget. Let's say in this case I embed siteB.com/widget on siteA.com (home page)

<iframe src="http://siteB.com/widget"></iframe>

And on siteB.com, I have the relevant google analytics installed. So my question is:

Will siteB.com google analytics be able to register siteA traffic? (one traffic to siteA.com equals to siteB.com/widget.)

Many thanks!

Upvotes: 2

Views: 1164

Answers (1)

imbondbaby
imbondbaby

Reputation: 6411

Short Answer : No, It is not as simple

For cross browser tracking:

https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingSite?csw=1#trackingIFrames

In a site where the transfer between domains is done by opening a new window or by including content in an iFrame, you will need to to use the _getLinkerUrl() method to transfer visitor and campaign cookies from one domain to another. For example, suppose you include a form in an iFrame that is hosted on www.my-example-iframecontent.com. In order to transfer visitor information from the parent page that hosts the iFrame on www.example-parent.com, you would use JavaScript to load the iFrame and pass in the cookie information using the _getLinkerURL() method.

There are different ways to setup and it all depends on your configuration. Therefore, I suggest that you setup some test profile and experiment with your settings.

Upvotes: 1

Related Questions