Google analytics intergration example.

Stop Hammertime.

Does anyone know of a clear example of the google analytics intergration code for flowplayer in action?

It is unclear to me from the documentation how it should be put in. I have tried various ways unsuccessfully.

Any help would be appreciated.

I am using the swfobject to put it in.

Cheers,

CalamityPhysics

Not working?

I'm having a tough time with this. I have a google analytics account already with the proper code on the webpage. I added the Google Analytics prefix of 'flvplayer' into the player code.. yet I don't see any entries for 'flvplayer' in our stats. Does the prefix have to be "flowplayer"?? Any help would be greatly appreciated!

My code for the player and Analytics are below:

PLAYER CODE:

window.onload = function() {flashembed("UglyStepChildPlayer",{src:'/Scripts/flowplayer/FlowPlayerClassic.swf',width: 406,height: 329},{config: {baseURL: 'http://www.uglystepchild.com/videos/',videoFile: 'CampaignIdol.flv',loop: false,menuItems: [ 1, 1, 1, 1, 1, 1, 0 ],usePlayOverlay: true,watermarkUrl: 'http://www.uglystepchild.com/images/overlay_USC2.png',watermarkLinkUrl: 'http://www.uglystepchild.com/default.asp?videoID=13',showWatermark: "always",autoPlay: true,initialScale: 'scale',googleAnalyticsPrefix: 'flvplayer'}});}

ANALYTICS CODE (UA# is X'd Out):

var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));

var pageTracker = _gat._getTracker("UA-XXXXXXX-X");
pageTracker._initData();
pageTracker._trackPageview();

GoogleAnalytics

Hi CalamityPhysics,

I have added these settings to my flowplayer, but not getting my results working on googleAnalytics. I was wondering if you could help.

Frosty

And then some.

And then with some help I figured it out.

For anyone else with a similar problem.

So the tracking code is as follows:

1. Make sure you have the latest version of flowplayer, I repeat the latest version.

2. Add the following directly before the closing tag, as directed by google analytics.


<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>
<script type="text/javascript">
_uacct = "<google analytics code goes here>";
urchinTracker();
</script>

3. Add the following: googleAnalyticsPrefix: 'flowplayer', into the code see example below.


<script type="text/javascript">
// <![CDATA[

var fo = new SWFObject("/includes/flowplayer/FlowPlayer.swf", "FlowPlayer", "380", "236", "7", "#ffffff", true);

// need this next line for local testing, it's optional if your swf is on the same domain as your html page

fo.addParam("allowScriptAccess", "always");

fo.addVariable("config", "{googleAnalyticsPrefix: 'flowplayer', showMenu: false, loop: false, startingBufferLength: 10, showFullScreenButton: false, menuItems:[false,false,true,true,false,false], showPlayListButtons: false, playList: [ { url: '<video item one.flv>', overlayId: 'play' }, { url: '<video item two.flv>' }, { overlayId: 'play' } ], initialScale: 'scale' }");

flashShow = true;

// fo.write("flowplayerholder");
// ]]>

</script>

Thanks for listening.

Cheers,
calamityphysics

Dirty fix ...

If you don't mind doing some coding/rebuilding and don't want to revert to the old urchinTracker implementation ... you can try this fix ...

http://community.flowplayer.org/node/667#comment-1161

-xppadmin