julesb...@hotmail.com
unread,Jun 20, 2013, 5:19:28 AM6/20/13Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to google-analytics...@googlegroups.com
Hi Guys,
I face a problem concernig the use of a regex in my API Query. Here are the Javascript codes :
//Trafic Direct
function requeteTrafficDirect (accountID){
accountID = 'xxxxxxx';
var apiQuery = gapi.client.analytics.data.ga.get({
'ids': 'ga:' + accountID,
'start-date': '2013-01-01',
'end-date': '2013-06-05',
'metrics': 'ga:visits, ga:transactions, ga:transactionRevenue , ga:visitBounceRate, ga:visitors, ga:newVisits',
'dimensions': 'ga:year, ga:week',
'sort': 'ga:year, ga:week',
'filters': 'ga:source==(direct)',
'max-results': 10000
});
apiQuery.execute(testImpressionRequete);
}
//E-mail
function requeteEmail (accountID){
accountID = 'xxxxxx';
regexp = '(messagerie-)|(mail(.*)\\.(.*)\\..{2\,4})|E-mail'
regexp = encodeURIComponent(regexp);
alert (regexp);
var apiQuery = gapi.client.analytics.data.ga.get({
// Attention c'est l'id du profil et pas du compte qu'on a chopé au dessus
'ids': 'ga:' + accountID,
'start-date': '2013-01-01',
'end-date': '2013-06-05',
'metrics': 'ga:visits, ga:transactions, ga:transactionRevenue , ga:visitBounceRate, ga:visitors, ga:newVisits',
'dimensions': 'ga:year, ga:week',
'sort': 'ga:year, ga:week',
'filters': 'ga:source=~' + regexp,
'max-results': 500
});
apiQuery.execute(testImpressionRequete);
}
The first query (Traffic direct) works well.
The second one (e-mail) is doesn't work at all... Indeed, all metrics results are "0".
The thing is that if i do the following regex : regexp = '(google|yahoo)'; The results are still "0".
If I test those regex to the Query explorer and results are good. There is something i didn't get. Can somebody help me please ?
The ultimate filter i'd like to do is the following : " include " " Source/medium " " regex " " (messagerie-)|(mail(.*)\.(.*)\..{2,4})|E-mail "
This what i've done in a customisable report.
Thanks for your time guys and have a nice day !
PS: hope my english is good enougth :)