Group by language in google analytics - google-analytics

I would like to see the data on Demographic -> Language grid grouped by ISO 3316 language, without differences between the (optional) ISO639 country code national variant.
For example, instead of seeing:
| Language | Visits |
|----------|--------|
| it | 56,027 |
| it-it | 35,130 |
| en-us | 5,878 |
| en | 1,211 |
| es | 897 |
| es-es | 576 |
| ... | ... |
I would like to see something like this:
| Language | Visits |
|----------|--------|
| it | 91,157 |
| en | 7,089 |
| es | 1473 |
|----------|--------|
Is it possible?

You can do an advanced filter at the profile level that will search and replace the language input field and keep only the first 2 letters.

If you want to keep the original language variations in your reports, you'll need to define your own dimension and use the tracking code (or Google Tag Manager) to fill it from the browser's language setting:
// this will extract 'it' from 'it-IT' or 'it-CH'
var primaryLanguage = navigator.language.match(/[^-]+/)[0];
ga('set', 'dimension1', primaryLanguage);
https://developers.google.com/analytics/devguides/collection/analyticsjs/custom-dims-mets
HTTP uses the IEFT Language Tag, so the primary language can be provided in different standards. It can consist of up to 8 letters. This usually won't be the case, but if you need to account for this, you need some extra logic to group languages from different standards.

Related

Robot Framework - Using Resource Files

I have a test file which checks for the presence of all key elements on every page of the app (one Scenario per page). However, the app is fairly complex and has different types of users (admin, regular, etc.) and I want to be able to go through the same pages.robot file with every type of user (and maybe have some if statements in that pages.robot file for every type of user) but I'm not sure how I should do it. I'm guessing I should be using a Resource File and set a global userType variable with admin, regular, etc. and run the pages.robot file multiple times (once per user type) but I'm not sure how to set up the Resource File and the userType variable.
Any ideas on how the Resource File should look like and then how to run the same file for every type of user?
You can store your test user configuration/properties in a resource file (say test_properties.txt) as below:
=== test_properties.txt ===
| *** Variables *** |
| ${tp_app_url} | http://yourapp.com |
| ${tp_browser} | firefox |
| ###### user roles to test with - admin, non-admin, regular |
| ${tp_user_type} | admin |
| ###### test users |
| ${tp_admin_user} | admin#app.com |
| ${tp_admin_password} | admin#123 |
| ${tp_regular_user} | regular#app.com |
| ${tp_regular_password} | regular#123 |
Here, the user role/type with which you want to test your application is defined as:
| ###### user roles to test with - admin, regular |
| ${tp_user_type} | admin |
Your test suite file can then import above resource file as below:
=== testsuite.txt ===
| *** settings *** |
| Library | Selenium2Library |
| Resource | test_properties.txt |
| *** test cases *** |
| Validate Page Controls |
| | Open Browser To Login Page | ${tp_user_type} |
| | Page Controls Should be Visible | ${tp_user_type} |
| *** keywords *** |
| Open Browser To Login Page |
| | [Arguments] | ${user_type} |
| | Open Browser | ${tp_app_url} | ${tp_browser} |
| | Input Username | ${tp_${user_type}_user} |
| | Input Password | ${tp_${user_type}_password} |
| | Submit Credentials |
| | Title Should Be | Welcome Page |
| Input Username |
| | [Arguments] | ${username} |
| | Input Text | username_field | ${username} |
| Input Password |
| | [Arguments] | ${password} |
| | Input Text | password_field | ${password} |
| Submit Credentials |
| | Click Button | login_button |
| Page Controls Should be Visible |
| | [Arguments] | ${user_type} |
Your code related to validating the page controls could reside in the keyword Page Controls Should be Visible which will perform the checks based on the user type argument.
Note: Test user's userId and password variables are formed here by embedding the user type variable as: ${tp_${user_type}_user} which in turn gets evaluated as ${tp_admin_user} in our case.
During execution, you can pass the value of ${tp_user_type} on command line, and it override the value set in the resource file.
pybot --variable tp_user_type:non-admin path/to/your/testfile
If you want to run the same tests with multiple user types, you can create a batch file like:
pybot --variable tp_user_type:non-admin path/to/your/testfile
pybot --variable tp_user_type:admin path/to/your/testfile
pybot --variable tp_user_type:regular path/to/your/testfile
I'm sure there will be a better solution than this for your problem. Ideally, the keywords defined above in the test suite file should reside in a resource file. You can also create a data-driven test to run your template keyword (which validates page controls) for each user type.

Creating a Static Drawing Whose dimensions get changed based on the parameters supplied

I want to create an static drawing (say any animals like giraffe) using some points, lines, drawing etc. Now i want to update the drawing by passing the parameters say height of his legs, its width or its color.
The parameters are supplied from the web page. The image will be a 2D image
I am searching on which technology should i implement this for more than 10 hours but cannot find any perfect solution.
Right now i am thinking i can use Adobe flash in which i can do some programming to create an drawing and change the drawing by passing the parameters to a Flash file, i think we can pass it when we embed an flv.
Whether i am right? Or there is any other solution. I have no knowledge of any thing except asp.net
Please help.
Any help is appreciated
I'd like to build on the previous post - you could also incorporate svg graphics into the mix. This would allow you control over color, width, and height. You can manipulate SVG files with javascript (Dynamic SVG). You'll probably get that going faster than learning action script.
If you just want to be able to stretch or recolor parts of an image, you could do that using ordinary HTML parameters. Just create a giraffe image, break it into the chunks that you want to be able to resize independently, and use CSS layout or tables to assemble them. Here's an artistic rendering:
___________________________
|image 1 V__ <<|
|head |oo | <<| <--- delicious acacia leaves
| | < <<<|
---------------------------
|image 2 | | |
|neck |o| |
| | | |
---------------------------
|image 3 / | |
|body /------/ \ |
| | \ |
---------------------------
|image 4| | | | | | | | |
|legs | | | | | | | | |
| \_/ \_/ \_/ \_/ | <--- I do not know what giraffe feet look like
---------------------------
If you want to give your giraffe a short neck without changing anything else about it, you can just alter the height attribute of the second image, like so:
___________________________
|image 1 V__ <<|
|head |oo | <<|
| | < <<<|
---------------------------
|image 2 | | |
---------------------------
|image 3 / | |
|body /------/ \ |
| | \ |
---------------------------
|image 4| | | | | | | | |
|legs | | | | | | | | |
| \_/ \_/ \_/ \_/ |
---------------------------
Obviously, changing the width of just one image would cause the boundaries to no longer match up, so you'd need to change them all to the same value.
To handle color changes, you can make use of image transparency. Each image would be white, with a transparent region representing the giraffe. Then, you'd set the background color of the div or table cell to the color you want the giraffe to appear. Again, this is clunky, but it would let you do what you want without needing anything other than static GIF / PNG images and basic HTML.

Arguments gone missing for robot-framework

The below is rewarded with a complaint that Remove Directory requires 1 or 2 arguments and I gave it none. I'm using 2.6.3, and dcsLshLocation is a variable (and adding an x in front doesn't change the error). I'm using the Java version of all this.
*** Settings ***
| Documentation | http://jira.basistech.net:8080/browse/JEST-226
| Resource | src/main/resources/jug-shared-keywords.txt
| Force Tags | integration |
| Suite Precondition | Run Keywords |
| | ... | Validate SUT Installations |
| | ... | Launch Derby Server |
| | ... | Copy file ${jddInstallDir}/conf/jdd-conf-basic.xml to ${jddInstallDir}/conf/jdd-conf.xml
| | ... | Remove Directory | ${dcsLshLocation} |
| Suite Teardown | Run Keywords | Shutdown Derby
| Test Timeout | 20 minutes
When this question was originally written, Run Keywords could only run keywords that do not take arguments. That is no longer true. From the documentation:
Starting from Robot Framework 2.7.6, keywords can also be run with arguments using upper case AND as a separator between keywords. The keywords are executed so that the first argument is the first keyword and proceeding arguments until the first AND are arguments to it. First argument after the first AND is the second keyword and proceeding arguments until the next AND are its arguments. And so on.
The code in the question can thus be expressed like this:
| Suite Precondition | Run Keywords |
| | ... | Validate SUT Installations
| | ... | AND | Launch Derby Server
| | ... | AND | Copy file ${jddInstallDir}/conf/jdd-conf-basic.xml to ${jddInstallDir}/conf/jdd-conf.xml
| | ... | AND | Remove Directory | ${dcsLshLocation}
The following is the original answer to the question, which others may still find useful. It is still relevant for versions of robot framework prior to 2.7.6.
When you use Run Keywords, you cannot run keywords that take arguments. Admittedly the documentation is a bit unclear, but this is what it says:
User keywords must nevertheless be used if the executed keywords need
to take arguments.
What it should say is that, when you use Run Keywords, each argument is the name of a keyword to run. This keyword cannot take any arguments itself because robot can't know where the arguments for one keyword ends and the next keyword begins.
Remember that ... simply means that the previous row is continued on the next, so while it looks like each row is a separate keyword with arguments, it's not. You example is the same as:
| Suite Precondition | Run Keywords |
| | ... | Validate SUT Installations |
| | ... | Launch Derby Server |
| | ... | Copy file ${jddInstallDir}/conf/jdd-conf-basic.xml to ${jddInstallDir}/conf/jdd-conf.xml
| | ... | Remove Directory |
| | ... | ${dcsLshLocation} |

Can ECB be restricted to "take over" only the current buffer when it's activated?

From the get go: sorry if I'm not using the proper emacs terminology -- I'm relatively wet behind the ears in the emacs world.
Most of my work in emacs is for programming R, and I'm using ESS and ECB to do so quite happily. I'd like to build a custom ECB layout which uses the entire bottom of the screen as my R console, while putting some ECB-specific buffers on the left.
Using ECB-esque layout diagrams, I'd like my layout to look like pretty much exactly like "left13", except I'd like the entirety of the "compilation" buffer to be my running R console (or any shell, for that matter):
-------------------------------------------------------
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| Directories | Edit |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
-------------------------------------------------------
| |
| R Console |
| |
-------------------------------------------------------
If I can just split my buffer in two (vertically), then call ecb-activate from the top buffer (and not allow it to touch my bottom buffer), I'm imagining it could work (hence the subject of my question).
That doesn't work, though, and I don't know how to get an entier "bottom pane" out of a layout to work in the way I like using trying to use ECB's customize layout functionality.
Does anybody know if/how I can do this?
Short answer: No.
Longer answer: Unfortunately, ECB completely takes over Emacs "window" management at a very low level. So it's all or nothing. You can't comfortably combine it with regular window splitting. What you might be able to do, is to adjust the layout ECB gives you or to program a custom layout. (Some assembly required.)

Accessing parent iframe from a childs iframe

Okay, I have an html page with two iframes on it so.
-------------------------------------------------
| PARENT |
| |
| |
| [iframe1 id=i1 name=i1] |
| |
| |
| |
| [iframe2 id=i2 name=i2] |
| |
| |
-------------------------------------------------
When I click on a link in iframe1, i need the resulting page to display in iframe2. I have tried:
<a href=blah.html target=parent.i2>link</a>
but that does not work.
any one know how to do this?
I think you might need JavaScript. Something like
onclick="javascript:parent.i2.document.location='blah.html'"
link
You just need to put "i2" it should be unique window name in this page. No need to specify parent etc.

Resources