Youtube Analytics API filters not working - youtube-api

I am trying to retrieve viewerPercentage based on gender, ageGroup filtering by country.
'ids' => 'channel=='.$channel->channel_id,
'start-date' => $monthAgo,
'end-date' => date("Y-m-d"),
'metrics' => 'viewerPercentage',
'dimensions' => 'ageGroup,gender',
'filter' => 'country=='.$country->code,
'access_token' => $tokens->access_token
The problem is that for each country it retrieves the same data. Therefore, for 50+ countries it gives the same data, which I don't think it is possible.
What I am doing wrong? Thank you
SOLVED
'filter' changed to 'filters'

Related

I want to list video from a list of channel

With youtube API, i would like to list video not only for one channel but from a list of channel,
with listSearch command it would be something like that ? but it's dont work ...
$searchResponse = $youtube->search->listSearch('id,snippet', array(
'maxResults' => _MAX_,
'type' => "video",
'order' => 'date',
"channelId" => "id_channel_1,id_channel_2, ..."
));

Roo getting number instead of text

I am using roo to parse out an excel sheet like this
worksheet.parse(
:partNo => "PM_PartNo",
:salePartNo => "PM_SalesPartNo",
:appSearchInclude => "PM_AppSearchInclude",
:desc => "PM_WebApp_Description",
:brand => "PM_Brand",
:appSegment => "PM_ApplicationSegment",
:group => "PM_ProductGroup",
:design => "PM_ProductDesign",
:material => "PM_Material",
:line => "PM_ProdLine",
:baseSeries => "PM_BaseSeries",
:colorCode => "PM_ColorCode",
:series => "PM_Series",
:weightType => "PM_oz_gram",
:appRim => "PM_ApplicationRim",
:coating => "PM_Coating",
:pcs => "PM_PCSconversion",
:clean => true
) do |hash|
However, Roo keeps giving me a number 200275577.0 for the PM_PartNo column. In the excel sheet, this column has all cells formatted as text. What is should return in the parse is "200275577" as text, not 200275577.0 as a number. Is there a way to ensure it adheres to the excel formatting?
This is an open issue with roo. There is a general workaround contributed by a user in the issue, or you can just convert the value yourself with .to_i.to_s.

Elastica multi_field setup

I'm trying to use multi_field syntax of elasticsearch in combination with Elastica. I create an index and an mapping which looks like this:
$mapping->setProperties(array(
'id' => array('type' => 'string', 'include_in_all' => true),
'title' => array('type' => 'string', 'include_in_all' => true),
'publisher' => array('type' => 'multi_field', 'include_in_all' => TRUE, 'fields' =>
array('publisherName' => array('type' => 'string', 'index' => 'analyzed'),
'untouched' => array('type' => 'string', 'index' => 'not_analyzed')
)
));
So far, so good. I can run queries against the title field.
But when I try to query the field "publisher" in http://example.com:9200/_plugin/head/ I'm not able to select the field publisher or to create a structured query. I looks, that the field publisher is not in the index.
But I can build facets on publisher.untouched which works very well. Whats wrong in my mapping? I need to search for the publisher.
See the docs on multi_field mapping. Looks like you need to set a default field by changing 'publisherName' to just 'publisher'.

How do you use the Gibbon Gem to automatically add subscribers to specific interest groups in MailChimp?

I'm trying to figure out how I can use the Gibbon gem in Rails to automatically add subscribers to specific interest groups in MailChimp?
I've found this article which details a non-Rails method for doing so: http://roman.tao.at/uncategorized/mailchimp-api-listsubscribe-listbatchsubscribe-and-groups/
I'd like to figure out how to implement that functionality using the Gibbon gem: https://github.com/amro/gibbon
FYI, I'm also a novice with both MailChimp and Rails.
Finally, after hours of perusing through code. I've found the example I'm looking for!
Thanks to TJ Moretto for providing this on a Google Groups thread:
I'm using the gibbon gem, but ran into the same types of issues.
Here's how I had to format the parameters to finally get this to work:
gb.list_subscribe({:id => "#{list.id}",
:email_address => user.email,
:update_existing => true,
:double_optin => false,
:send_welcome => false,
:merge_vars => {'FNAME' => "#{user.first_name}",
'LNAME' => "#{user.last_name}",
'GROUPINGS' => {0 => {'id' => grouping.id, 'groups' => "#{challenge.name}"}}}
})
Hope that helps.
Mailchimp Team - based on the number of issues that everyone runs into
when trying to do this (across all programming languages), I suggest
you update the API documentation to be more clear.
Update for version 2.0 of the MailChimp API and version 1.0 of Gibbon (For #Calin and posterity). Here are the necessary changes from the previous version. The API object is accessed like this now:
gb = Gibbon::API.new
And list methods like so:
gb.lists.subscribe(params)
Finally the :email_address parameter has been replaced by the :email parameter, which should be given a value of the following form: The value should itself be a hash with one key, either 'email' or 'leid', and the value should be either the email address of the subscriber or MC's unique identifier (LEID) for the subscriber.
So a full subscription call might look something like this:
gb = Gibbon::API.new
gb.lists.subscribe(:id => "ed6d1dfef4",
:email =>
{ "email" => "example#domain.com" },
:merge_vars =>
{:groupings =>
{
0 => { :id => "95", :groups => ["Some Group", "Another Group"]},
1 => { :id => "34", :groups => ["A Third Group"]}
}
},
:update_existing => "true",
:double_optin => "false",
:replace_interests => "false")

Unknown record property / related component with multi refs to one table

in model definition
$this->hasMany('Photo', array(
'refClass' => 'StyleLangHasPhoto',
'local' => 'style_lang_id',
'foreign' => 'photo_id'));
$this->hasMany('Photo as Preview', array(
'refClass' => 'StyleLangHasPreviewPhoto',
'local' => 'style_lang_id',
'foreign' => 'photo_id'));
but getter getPreview and even $this->_get('Preview') throws Unknown record property / related component "Preview" on "StyleLang"
i've try to make like this
$this->hasMany('Photo as Slide', array(
'refClass' => 'StyleLangHasPhoto',
'local' => 'style_lang_id',
'foreign' => 'photo_id'));
$this->hasMany('Photo as Preview', array(
'refClass' => 'StyleLangHasPreviewPhoto',
'local' => 'style_lang_id',
'foreign' => 'photo_id'));
but nothing changes
what i'm doing wrong?
UDP1: getPhoto, setPhoto, setPreview works good
problem was solved
foreignAlias: in relations for Photo and Preview must be different
thanx

Resources