简体   繁体   English

CakePHP从Google Analytics(分析)保存数据

[英]CakePHP saving data from Google Analytics

I've been working with this plugin: http://www.neilcrookes.com/2009/09/27/get-google-analytics-data-in-your-cakephp/ but honestly it's over my head. 我一直在使用此插件: http : //www.neilcrookes.com/2009/09/27/get-google-analytics-data-in-your-cakephp/,但说实话,这已经超出了我的范围。

Under Analytic.php it seems useTable is set to false, however, when it's true it throws an error. 在Analytic.php下,似乎useTable设置为false,但是,当它为true时,它将引发错误。 I am new to Cake and Cake plugins, so maybe I am interacting the wrong way. 我是Cake和Cake插件的新手,所以也许我交互的方式错误。

I'd like to save the dimensions and metrics being pulled into a database using cake. 我想保存使用Cake提取到数据库的维度和指标。 Any direction would be greatly appreciated. 任何方向将不胜感激。

the model has useTable = false as it is using a datasource to get the data. 该模型具有useTable = false,因为它正在使用数据源来获取数据。 you cant just set it to true, and it wont work any other way. 您不能将其设置为true,也不能以其他任何方式工作。 if you want to save it create a new model with a db table like normal and then do something like the following. 如果要保存它,请使用正常的db表创建一个新模型,然后执行以下操作。

in new model... 在新模型中...

$data = ClassRegistry::init('AnaliticsModel')->findMethod();

then manipulate it how you need 然后根据需要进行操作

$this->save($data);

its now in your db... you can then do $this->find() <-- normal cake stuff on the new model 它现在在您的数据库中...然后,您可以在新模型上执行$this->find() <-普通的蛋糕东西

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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