Mobile app version of vmapp.org
Login or Join
Angie530

: How can I get stats for what 3rd-party sites have embedded our iframe widget? Say we've produced a widget for other sites to use, like so: <iframe src="http://example.com/whatever.php" frameBorder="0"

@Angie530

Posted in: #Analytics #GoogleAnalytics #Statistics #Widgets

Say we've produced a widget for other sites to use, like so:

<iframe src="http://example.com/whatever.php" frameBorder="0" width="200px" height="300px" scrolling="no"></iframe>


The client would like to be able to see within GA who has embedded the thing. Is there some referer information automatically passed that I can look for, or do I need to add something?

whatever.php is already loading the analytics Javascript(we're also tracking clicks on an outbound link).

[EDIT]
Looking around a bit more, I found what seems to be a similar question on SO with an answer saying this can be found, automatically, but I still can't seem to find the information. The question's also old enough the respondent is probably referring to the old interface, though. Maybe someone could explain getting to it in the new look. (I won't likely be able to train this client to switch, deal with the old look, etc.)

10.04% popularity Vote Up Vote Down


Login to follow query

More posts by @Angie530

4 Comments

Sorted by latest first Latest Oldest Best

 

@XinRu657

If you have not modified the tracking snippet, this traffic will typically end up on your client's Traffic Sources > Referrals report - unless the widget is embedded in a document served over SSL or the user-agent is configured not to send the referrer header. (change the embed code to src="//example.com/whatever.php" if possible)

This may be acceptable (particularly if you have set up a separate profile for tracking the widget) but you can get more reliable results if you use Javascript from within the embedding document to pass the actual referrer to your widget.

Embed Code

<iframe frameBorder="0" width="200" height="300" scrolling="no" onload="this.src='//example.com/whatever.php?ref='+encodeURIComponent(window.location);"></iframe>


Widget Document

<!-- ga.js snippet -->
<script type="text/javascript">

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXX-X']);
<?php
if (
array_key_exists('ref', $_GET) &&
$_GET['ref']
){
?>
_gaq.push(['_setReferrerOverride', '<?php echo $_GET['ref']; ?>' );
<?php
}
?>
_gaq.push(['_trackPageview']);

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

</script>
<!-- eof ga.js snippet -->


Note: This method could use some polish - the iframe call isn't semantically valid HTML (though example in question was not either).

10% popularity Vote Up Vote Down


 

@Alves908

You might be able to use GA's _trackPageview, and grab the domain of the referrer via javascript(something like j=document.referrer, _trackPageview(j)) maybe.

Haven't tried that myself, but have used custom _trackPageview('Page Descriptors') before.

10% popularity Vote Up Vote Down


 

@Angela700

I would add a single pixel image into the HTML that that iframe is using. Check your raw access logs for each time the image has been accessed and extract the unique domains / IP's from the logs. You may be able to use the image tracking feature on getclicky.com over the javascript to have the stats in their application / interface

10% popularity Vote Up Vote Down


 

@Caterina187

Do you do server log file analysis, if so the simplest (hacky) way would be to track the requests for image content within the widget.

I had quick google and this thread seems pertinent to your problem

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme