简体   繁体   中英

How do I use Google Analytics _trackEvent on a clickable Flash banner?

Currently, I use the following href tags around my jpg banners to track whenever someone clicks on them:

<a href="#" onClick="_gaq.push(['_trackEvent', 'Banner Ads','Zwanger Pesiri', 'Skyscraper']);" target="_blank"></a>

I now have a Flash ad that I need to use in the same manner, but I'm not that good with either Actionscript or Javascript. My Flash banner has the following Actionscript to make the ad clickable:

on(release) {
getURL("http://www.zwangerpesiri.com", "_blank");
}

How do I change the Actionscript so that it has the tracking info attached to it that the jpg would have?

Try this ActionScript in your on(release) event:

ExternalInterface.call("_gaq.push(['_trackEvent','Banner Ads', 'Zwanger Pesiri', 'Skyscraper'])");

This assumes you already have the Google Analytics on your site somewhere. Otherwise, you'd need to include the AnalyticsTracker and GATracker libraries in your Flash file (which also significantly increases the .swf file size).

Here is an example I made where you can download my .fla files if you're interested in learning more.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM