为Actionscript 2实施谷歌分析跟踪的最佳方式是什么? [英] What is the best way to implement google analytics tracking for Actionscript 2?

查看:169
本文介绍了为Actionscript 2实施谷歌分析跟踪的最佳方式是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找代码,示例,库,用于使用Actionscript 2 Flash电影使用Google Analytics分析事件跟踪的组件。我可以在google代码网站上找到有关AS3的信息,但不能查看AS2。什么是关于标记Flash文件以使用异步Google分析代码的教程和示例的最佳资源。我发现了一些旧的谷歌分析代码的旧信息。

I am looking for code, examples, library, components for using google analytics event tracking with my Actionscript 2 Flash movies. I can find info about AS3 on the google code site but not AS2. What is the best resource for tutorials and examples about tagging my Flash files to use the asynch google analytics code. I have found some old information about the old google analytics code.

谢谢

thanks

推荐答案

我已经将这添加到我的Flash项目中,并且它似乎迄今为止工作。我还没有离开它足够长的时间来检查谷歌分析报告的内容,但我会更新这个答案。

I have added this to my Flash projects and it seems to work so far. I have not left it long enough to check what has come through on google analytics reports yet but I will update this answer with what comes through.

import flash.external.ExternalInterface;
//
function ga_track_pageview(_event:String) {
     if(ExternalInterface.available) {
        ExternalInterface.call("_gaq.push",['_trackPageview', _event]);
    }   
}
function ga_track_event(_category:String, _action:String, _label:String, _value:Number) {
     if(ExternalInterface.available) {
        ExternalInterface.call("_gaq.push",['_trackEvent', _category, _action, _label, _value]);
    }   
}
//
// Button 1 pressed - 
btn_1.onRelease = function() {
    _root.ga_track_event("button", "pressed", "button1", null);
}
// Button 2 pressed - 
btn_2.onRelease = function() {
    _root.ga_track_event("button", "pressed", "button2", null);
}
// Tracking a page view -
ga_track_pageview("testpage_opened");

这篇关于为Actionscript 2实施谷歌分析跟踪的最佳方式是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆