We just send our first campaign (300k subs) and when I want to view the campaign the overview page gives a timeout.
After some debuging I found the origin of the problem in CampaignOpenUserAgentsWidget that takes way too much time.
My quick fix:
In \apps\customer\components\web\widgets\campaign-tracking\CampaignOpenUserAgentsWidget.php
change $limit to 10000
add new function
and then change getData()
to
also change 2x
to
and all 3 occurrence of
to
Never used Yii before so don't know if there was a better method?
But at least now my campaign overview loads in 5seconds
After some debuging I found the origin of the problem in CampaignOpenUserAgentsWidget that takes way too much time.
My quick fix:
In \apps\customer\components\web\widgets\campaign-tracking\CampaignOpenUserAgentsWidget.php
change $limit to 10000
add new function
Code:
/**
* @param $limit
* @param $offset
*
* @return array
*/
protected function getDBGroupData($limit, $offset)
{
return Yii::app()->db->createCommand()
->select('user_agent, count(user_agent) as count')
->from(CampaignTrackOpen::model()->tableSchema->name)
->where('campaign_id=:campaign_id', array(':campaign_id'=>(int)$this->campaign->campaign_id))
->group('user_agent')
->limit($limit)
->offset($offset)
->queryAll();
}
and then change getData()
Code:
while (($models = $this->getModels($limit, $offset))) {
Code:
while (($models = $this->getDBGroupData($limit, $offset))) {
also change 2x
Code:
$model->user_agent
Code:
$model['user_agent']
and all 3 occurrence of
Code:
['count']++
Code:
['count'] += $model['count']
Never used Yii before so don't know if there was a better method?
But at least now my campaign overview loads in 5seconds