Google Analytics Language Codes - google-analytics

Need help with Google Analytics filters via Custom Reports -- Display LANGUAGE and VISITS where the LANGUAGE values are grouped as EN for each English, etc via 'FlatTable'
My report returns (see first 3 lines):
LANGUAGE | VISITS
---------+-------
en-us | 55,842
en | 3,932
en_us | 248
I would like to see:
LANGUAGE | VISITS
---------------------+----------+-------
1. en | 60,022
2. ...
3. ...

I'd recommend creating a Custom Dimension to store an extracted part from the Language Setting dimension via an Advanced Filter.
That way you will extend your data instead of replacing parts of it.
Create a Dimension LanguageCode with scope User or Session in the property's settings (Admin > Property > Custom Definitions > Custom Dimensions)
Create an advanced filter Extract Language Code in the view's filter settings (Admin > View > Filter) like so:
Field A: Language Settings ([a-z]{1,3}).*
Output in: Language (the Custom Dimension) $A1
Be aware that filters get applied during processing, which happens once a day. That means you'll be able to see the result the next day.
Then you'll be able to view reports or build a custom report that uses that new Language Code dimension.

If I'm understanding you correctly, go to Custom Reports and set one up like this:
Then, go and to the newly created report and apply a secondary dimension of Language. If you want to 'group' them by language, do a sort by Language.
I add Language to the dimension drilldown so if you were interested in seeing the possible language selection for a particular country you could do that by clicking on the country.

In Google Analytics Admin create an additional view to the property. Then create two custom filters:
Name (e.g. Language lowercase): Lowercase -> Filter Field: Language
Settings;
Name (e.g. Language generalisation): Search and Replace ->
Filter Field: Language Settings : Search string: ([a-z]{1,3})[-_]?.* Replace string: \1
That is it. Now all languages in the view will be up to 3 character long and aggregated.
Actually the regex can be more strong, but this one is more wide and covers even some wrong language settings.

Related

Google Tag Manager web or Apps - conditionally use Google Analytics Settings Variable

I am setting up GTM and wonder if I can use different Google Analytics Setting variable conditionally.
For example, if Page URL contains staging then use GA Settings 1 variable, if not GA Settings 2
These two GA settings differs not only in Google Analytics Property ID but in a number of fields and custom dimensions. An alternative would be to duplicate tags which is not really what I would want to do...
I just found this post whilst trying to achieve (I think) the same thing so for the benefit of searches here is my scenario and resolution.
My client's site is accessible via two domains (.com and .ie) each of which has their own GA property, but it is a single site connected to a single GTM container. I want to send data to the appropriate GA property based on the hostname.
In the GTM container I have created a lookup table variable which lists the hostname and the GA ID as appropriate, e.g.:
www.mysite.com | UA-123123-1
www.mysite.ie | UA-234234-2
In my tag, I then can select this variable as my tracking ID. Importantly, I have to set the tag to allow overriding settings, which then allows me to set the tracking ID to this non-GAS variable type. If you just use the select box to select the GA variable then it will only allow you to select GA Settings variable types.
I have not yet tested this solution to set dimensions and fields but I would imagine you can you use a similar process.
No there is no option at the moment:
As you saw GA Settings variables don't allow you to do so
GTM environments are meant for different purposes
Using a Javascript variable returning GA Settings (see below) could work in theory but you're simply not allowed to select a variable that's not a GA Settings type from your tag, so no as well.
Workaround idea (point 3) that can't be used:
function() {
if ( ) return {{GA Settings 1}};
return {{GA Settings 2}};
}
So your options are:
Separate tags
Conditional custom HTML tag so you set the fields yourself with complete flexibility for each environment
1 tag with conditional variables: you set the fields/custom dimensions for both, except that the variables used return default values (for fields) or empty values (for custom dimensions) when they are not indeed in 1 environment.

Drupal 7 views - how to combine a contextual filter with a regular filter (with OR)?

Ok, so I have a "playlist" content type, with a node reference field and a boolean field called "always display this playlist".
I have a "playlists" view with a contextual filter based on the node reference. So, when I go to "/playlists/35", it shows all the playlists that reference node 35.
All good so far.
One extra requirement is that the view needs to also display all the playlist that have the "always_display_playlist" field set to 1 (that's the boolean field).
So basically the view needs to display playlists that match the contextual filter OR that have the boolean field set to 1.
So far I have failed rather miserably in making that work. The contextual filter works great, but of course it will only display playlists that have the node reference matching the argument. How can I combine the contextual filter with another regular filter, but with "or"?
Thanks a lot for any clue or idea!
Option 1
Consider the Views Contextual Filters OR module, which only has a dev version today. Excerpt from its project page:
... provides a views plugin which modify query to support OR conditions for contextual filters.
Option 2
Otherwise the Views EVI (Exposed Value Injector) module, which only has a beta version today. Excerpt from its project page:
This module solves the fundamental and longstanding problem (#357082: Pull filter value from an argument? & Itangalos Sandbox) of views argument filters (=contextual filters): they are far less potent than regular filters.
It does this by allowing to wire argument tokens to exposed filters and optionally hide them. It also allows new use cases, think: use one exposed widget for two filters.
Credits (for Option 2): Hubert
If you click on the dropdown beside filters you could potentially use two different filter groups, one that corresponds to the contextual filter and manage it with views filter harmonizer and the other group with the boolean filter and have the OR between them.

Creating own Report in Odoo: t-field for date, Customer ID etc.?

First of all I'm kinda new to Odoo and I'm trying to understand some Basic logic. I created my own Report based on the Basic Report of Odoo.
There are a lot of fields like t-field="o.date_invoice" or t-field="o.partner_id etc. which work really fine but where can I find all functions? Is there any list?
For Example I Need a Field for the order date and for the print date or for a Customer ID.
With a t-field attribute you can access and print fields from the actual model or from a related model, for example with the following element you can print the content of the phone column (field) of the actual record:
<span t-if="o.phone"
t-field="o.phone" />
Explanation of t-field in the documentation:
The t-field directive can only be used when performing field access
(a.b) on a "smart" record (result of the browse method). It is able to
automatically format based on field type, and is integrated in the
website's rich text edition.
Check this link for further information if you want to build reports and this one, where you can read about some the elements that you can use in Qweb
In addition, you can check here a list of some attributes that you can use in a Qweb template

How to use a GET variable as a column in Google Analytics?

Say my URL is in the format of www.mywebsite.com/search?keywords=library.
Aside from using Page Level 1 or Page Level 2, is there any way I could specifically get the value of a certain GET variable to be the column of my Google Analytics table?
I currently have this table (see below), but I'm using a Page Level column which I think is kind of a cheat. I'd prefer if there was a method to just pull through a specific section of the URL.
Is there a way to do this?
You can create a custom dimension in analytics. Go to your property settings -> custom definitions -> custom dimensions -> new. Give it a name (that will appear as column label in your reports). Since the keyword is part of the url hit level scope seems the best fit (meaning that your dimension is associated with a specific user interaction - you could also choose to tie it to the complete session).
If you create the custom dimension it will have a numeric index which you use in your tracking code together with the "dimension" keyword. The following example assumes you have created your first dimension (index 1) and are using php:
ga('send', 'pageview', {
'dimension1': "<?php echo filter_input(INPUT_GET, 'keywords', FILTER_SANITIZE_ENCODED); ?>"
});
(you can use another/better filter but do not put the variable directly into your page).
Now the value is send along with the pageview. Custom dimension do not show up in the standard reports, but you can use them in custom reports or set them as secondary dimensions in your standard reports.

Drupal 7 - how to set up and translate field collection

I have taxonomy term with field collection field set to unlimited values. FC contains few texfield, textarea and image fields. FC and it's fields are set to be translated by user.
Taxonomy term is localized - all terms are the same for all languages just that they are translated. I have entity translation turned on for taxonomy term and node but not for FC because it trigers notice about not valid base path.
With this configuration: I create term and save it, after initial creation i can add any number of FCs and save them. On translate form I can then add translations for them. And when saved values remain saved for different laguages.
Problem occures when I create a view with relationship to FC, add FC fields and set contextual filter to termID (showing this view via panel on taxonomy terms). Field language stting is set to current user language. On views preview with manually set termID I see proper result for language in url (en/admin/structure/views..) and correct result if I change language prefix. But on term page it doesn't show anything.
I am using latest dev entiy translation an field collection modules.
I also tried setup with entity translation enabled for FC but again i don't get right output from views.
Where am I doing it wrong? FC setup, multilangual setup or in views. Does anyone have a hint how to make FC translatable?
I retested on clean installation. All this apply for what I described in #9 . Same result but some new/confirmed observations and possible workaround:
There is a bug in FC when translating fields for the first time values are not properly saved:
values are saved but when I refresh edit page, fields exist but are
empty/blank, fields on default language are ok
what really happens: when saving translation of FC fields, they are wrongfully linked to default language and not to translated one, also they don't show up when reopening default language so that they could be deleted. This can be bad if you accidentally catch them in a view as I did (for some time this was misleading me because titles were the same).
possible workaround: when first translating you have to delete values that are copied from default language and save it, then you can enter translated values
ET for FC enabled: same issue and workaround
After creating some content on terms and translating them with workaround, I tried to show them in panels via view.
I created a panel and set selection to taxonomy vocabulary I am using and under content I created "new custom content" in which I included some substitutions - for FC field %term:field_test_fc (this is my test content)
when I change language, values change accordingly to selected language
substitution renders all fields of FC and shows them in correct language
this is why this issue is bugging me… it should work on a view too because if term itself can distinguish between different languages of FC fields so can view via panel
I created view (page) in which I list all FC fields of all terms grouped by term name using relationship of that FC
content does change accordingly to the selected language =)
I created another view (content pane) as above and just added context filter, set it to termID and attach it to panels
view shows only FC fields of language that was used last when saving term. This mean that when editing and saving term in default language, view will only show fields of default language. weird :S
ET for FC enabled: it broke both views (showing fields of all languages everywhere), fixed by adding filter based on FC field: language and setting it to current user language
panels view still didn’t work as expected, but I knew that there was a problem with context filter
what I had to do is to remove validation criteria from context filter ( termID)
After solving last problem, view for panel is working and viewing term in both languages shows correct (translated) FC fields =).
Hope it helps understanding where problems occur and how to go around them. Fix would be nice though =)
Field Collections as a module has not yet been patched to support multilingual well. The debate is whether the field collection itself should be set to language-neutral, allowing the underlying fields to be language specific.
However, the field-collection module by itself does not currently support multilingual. There are a number of patches related to this on Drupal.org, including the following two major patch threads:
https://drupal.org/node/1344672
https://drupal.org/node/1316162
The Lingotek Translation module for Drupal 7 is successful at translating field collections and displaying them because it gets around the limitations of the Field Collection module using a combination of hook_entity_load, hook_entity_update, and a translation process that does not rely on the entity_translation module's UI.

Resources