Copy Google Analytics View does not copy "content grouping" rules - google-analytics

When you copy a view in google analytics "content grouping" is not copied to the new view.
If copying the view does not work then how can i copy or move "content grouping rules" between views ?
I have a lot of rules and i can't recreate everything each time i tried a new view.

As Eike Says, yes the account creation seems to be limited as the API, i run some test and the Channel Grouping, Content Grouping and Calculated Metrics are not being passed to the new account.
So them, what is copie? : You can find the list of parameters copied with this feature.
{
"id": string,
"kind": "analytics#profile", //unmutable
"selfLink": string,
"accountId": string,
"webPropertyId": string,
"internalWebPropertyId": string,
"name": string,
"currency": string,
"timezone": string,
"websiteUrl": string,
"defaultPage": string,
"excludeQueryParameters": string,
"siteSearchQueryParameters": string,
"stripSiteSearchQueryParameters": boolean,
"siteSearchCategoryParameters": string,
"stripSiteSearchCategoryParameters": boolean,
"type": string,
"permissions": {
"effective": [
string
]
},
"created": datetime,
"updated": datetime,
"eCommerceTracking": boolean,
"enhancedECommerceTracking": boolean,
"botFilteringEnabled": boolean,
"starred": boolean,
"parentLink": {
"type": "analytics#webproperty",
"href": string
},
"childLink": {
"type": "analytics#goals",
"href": string
}
}
What I do to override this limitation is build a Javascript+Jquery function that clicks on the differents element to automatice the Channel Grouping (this because i got a tons of rules too)
Greetings

Related

Get CosmosDb Primary Connection String in ARM template

I have an ARM template which sources the primaryMasterKey of a cosmosDb as follows:
{
"properties": {
"enabled": true,
"siteConfig": {
"appSettings": [
{
"name": "MongoDb:CnnDetails",
"value": "[listKeys(resourceId('Microsoft.DocumentDB/databaseAccounts', variables('cosmosdb_full')), '2015-04-08').primaryMasterKey]"
}
}
How to I modify it to get the actual connection string instead?
I've tried couple of things:
changed the word primaryMasterKey to primaryConnectionString. This gives an error saying:
'The language expression property 'primaryConnectionString' doesn't exist, available properties are 'primaryMasterKey, secondaryMasterKey, primaryReadonlyMasterKey, secondaryReadonlyMasterKey'
changed the work listKeys to listConnectionStrings. This is red underlined in my visual studio, but seems to work when put through azure devops
'The language expression property 'primaryConnectionString' doesn't exist, available properties are 'connectionStrings'
I went to https://learn.microsoft.com/en-us/rest/api/cosmos-db-resource-provider/databaseaccounts/listconnectionstrings#code-try-0 to try it out. ListKeys returns a structure like this:
{
"primaryMasterKey": "[REDACTED]",
"secondaryMasterKey": "[REDACTED]",
"primaryReadonlyMasterKey": "[REDACTED]",
"secondaryReadonlyMasterKey": "[REDACTED]"
}
so I get why the .primaryMasterKey worked. But ListConnectionStrings returns:
{
"connectionStrings": [
{
"connectionString": "mongodb://[REDACTED]:10255/?ssl=true&replicaSet=globaldb",
"description": "Primary MongoDB Connection String"
},
{
"connectionString": "mongodb://[REDACTED]:10255/?ssl=true&replicaSet=globaldb",
"description": "Secondary MongoDB Connection String"
},
{
"connectionString": "mongodb://[REDACTED]:10255/?ssl=true&replicaSet=globaldb",
"description": "Primary Read-Only MongoDB Connection String"
},
{
"connectionString": "mongodb://[REDACTED]:10255/?ssl=true&replicaSet=globaldb",
"description": "Secondary Read-Only MongoDB Connection String"
}
]
}
Not sure how to "index into it"?
Any clues gratefully received.
For anyone else finding this question and wanting a fully complete ARM Template snippet, this is what I have used and is working:
"connectionStrings": [
{
"name": "CosmosConnection",
"connectionString": "[listConnectionStrings(resourceId('Microsoft.DocumentDB/databaseAccounts', parameters('cosmosDbAccountName')), '2019-12-12').connectionStrings[0].connectionString]",
"type": 3
}
]
like you normally would in almost any language:
ListConnectionStrings.connectionStrings[index].connectionString
index starts at 0.
you have a more "native" way of doing this:
first(ListConnectionStrings.connectionStrings).connectionString
but only available functions are first and last
The answer here by oatsoda is correct but it will only work if you are within the same resource group as the Cosmos DB you are getting the connection string for. If you have the scenario where you Cosmos DB is in a different resource group to the resource you are generating an ARM template for the following snippet is what I have used to generate the connection string for an App Service and is working.
"Cosmos": {
"value": "[listConnectionStrings(resourceId(parameters('cosmosResourceGroupName'),'Microsoft.DocumentDB/databaseAccounts', parameters('cosmosDbName')), '2019-12-12').connectionStrings[0].connectionString]",
"type": "Custom"
}
In the Cosmos linked ARM template named linkedTemplate_cosmos_db-gdp-event-ammi-dev-ne-001 I used the following code.
"outputs": {
"ConnectionString": {
"value": "[listConnectionStrings(resourceId('Microsoft.DocumentDB/databaseAccounts', parameters('accountName')), '2019-12-12').connectionStrings[0].connectionString]",
"name": "CosmosConnection",
"type": "string"
}
},
and then in the ARM template (linkedTemplate_Main) that uses the output parameter, the following, e.g a function app configuration setting
"COSMOS_CONNECTION_STRING": {
"value": "[reference('linkedTemplate_cosmos_db-gdp-event-ammi-dev-ne-001').outputs.ConnectionString.value]"

Access definitions on ref property with newtonsoft.json.schema

I want to have access to the definitions in the schema in order to get the naming of the definition. I am using newtonsoft.json v11.01
I am building a c# converter for jsonschema to make a syntaxtree and compile it in order to get a typed version of the object at runtime.
{
"$id": "https://example.com/arrays.schema.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "xml remarks",
"type": "object",
"properties": {
"fruits": {
"type": "array",
"items": {
"type": "object",
"title": "fruit",
"required": ["naam"],
"properties": {
"naam": {
"type": "string",
"description": "The name of the fruit."
}
}
}
},
"vegetables": {
"type": "array",
"items": { "$ref": "#/definitions/veggie" }
}
},
"definitions": {
"veggie": {
"type": "object",
"required": [ "veggieName", "veggieLike" ],
"properties": {
"veggieName": {
"type": "string",
"description": "The name of the vegetable."
},
"veggieLike": {
"type": "boolean",
"description": "Do I like this vegetable?"
}
}
}
}
}
in the schema a reference is created with the name veggie. This is used in the property vegetable with a reference.
Json schema contains a definition on the root object but is doesn't have it on the property element. On the property element there is nothing identifiable to point to the right definition.
how do i find the right definition for the property?
In general, in order to resolve a json-pointer (a $ref is a "uri-reference", and the part after the # is a "json-pointer"), you need to have access to the root of the json document.
So if you currently have a function that only gets an argument that points to the "properties" section, then you need to give that function a second argument that points to the root of the document.
(It gets more complicated when you're using a schema made up of more than one file; then you need a second argument that points to the roots of all the schema documents)
It's one of the more difficult parts of writing software that interprets json-schema files, especially if your language/library doesn't have support for json-pointers built-in - you'll need to write it yourself in that case.

Updating a DynamoDB item with a new attribute that's a list

So I have an item in DynamoDB:
{
"id": "1",
"foo": "bar"
}
And I want to add a new attribute to said item, the attribute being:
{
"newAttr": [{ "bar": 1 }, { "bar": 2 }, { "bar": 3 }]
}
Now I'm doing this in JS using the AWS-SDK like so:
client.update({
ExpressionAttributeNames: { '#newAttr': 'newAttr' },
ExpressionAttributeValues: { ':newAttr': newAttr },
Key: { "id": "1" },
TableName: "foo",
UpdateExpression: "SET #newAttr = :newAttr"
}, callback)
However, I get an error:
ExpressionAttributeValues contains invalid value: One or more
parameter values were invalid: An AttributeValue may not contain an
empty string for key :newAttr
So if I were to JSON.stringify(newAttr) then it's fine, but I don't want this new attribute to be a string, I want it to be a list.
So what am I doing wrong?
Try ADD instead of SET
client.update({
ExpressionAttributeNames: { '#newAttr': 'newAttr' },
ExpressionAttributeValues: { ':newAttr': newAttr },
Key: { "id": "1" },
TableName: "foo",
UpdateExpression: "ADD #newAttr = :newAttr"
}, callback)
I ended up having these issues in the beginning. I'm sure you are wasting time in writing in all the low-level code to interact with DynamoDB.
Use an ODM (ORM Like) for document storage which handles all the hurdles for you.
https://github.com/clarkie/dynogels
is what I have used and will make your life much easier.
Empty String are not allowed
One cannot store empty strings with DynamoDB at the root level. You can have it in the nested objects.
Allowed Data Types from DynamoDB:
http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.NamingRulesDataTypes.html
Hope this helps.

Model Firebase realtime database in JSON schema

The Firebase database uses a subset of JSON. Thus it seems obvious to use JSON schema to describe the data model. This would allow to make use of tools which generate HTML forms or typescript models from it or generate random test data.
My question: How would one model key-value pairs in JSON schema, where the key is an id?
Example: (borrowed from firebase spec)
{
"users": {
"mchen": {
"name": "Mary Chen",
// index Mary's groups in her profile
"groups": {
// the value here doesn't matter, just that the key exists
"alpha": true,
"charlie": true
}
},
...
The group name here is used as an group id. In this reference (groups object) as well as in the group object itself, the id is used as the property name.
JSON schema for above example is:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"users": {
"type": "object",
"properties": {
"mchen": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"groups": {
"type": "object",
"properties": {
"alpha": {
"type": "boolean"
},
"charlie": {
"type": "boolean"
}
}
}
}
}
}
}
}
}
What I would need for the example is something like the following, where NAME is a placeholder for the property name and NAME_TYPE defines it's type.
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"users": {
"type": "object",
"properties": {
NAME: {
"type": "object",
NAME_TYPE: "string",
"properties": {
"name": {
"type": "string"
},
"groups": {
"type": "object",
"properties": {
NAME: {
NAME_TYPE: "string"
"type": "boolean"
}
}
}
}
}
}
}
}
}
(Maybe I am on the completely wrong path here or maybe JSON schema isn't able to model the required structure.)
There are certainly arrays in Firebase but they are situational and should be used only in certain use cases and should generally be avoided.
The Firebase structure you posted is very common and there are key:value pairs in your structure so the question is a tad unclear but I'll give it a shot.
'groups' is the parent key and the values are the children key:value pairs of group1:value, group2:value.
The group1, group2 keys you listed are essentially the same as the id's listed in the first example, other than it's not an array. i.e. array's have sequential, hard coded-indexes (0th, 1st, 2nd etc) whereas the keys in firebase are open-ended and can generally be set to any alphanumeric value - they are used more to refer to a specific node than the enforce an particular order (i'm speaking generally here)
In the Firebase structure, those keys could be id0, id1, id2... or a,b,c... or a timestamp... or an auto-generated Firebase id (childByAutoId) that would also make them 'sequential'.
However, you can get into trouble assigning your own with id0, id1 etc.
id0
id1
id2
.
id9
id10
id11
The reality here is that the actual order will be
id0
id1
id10
id11
id2
The 'key' is that if you are using the keys to read data in sequentially, set them up as such. You may also want to consider generating your keys with childByAutoId (see docs for language specifics) and orderBy one of the child values such as a timestamp or index.
'groups': {
'auto-generated id': {
'name': 'alpha',
'index': 0,
'timestamp': '20160814074146'
...
},
'auto-generated id': {
'name': 'charlie',
'index': 1,
'timestamp': '20160814073600'
...
},
...
}
in the above case, I can orderBy name, index or timestamp.
Name and index will read the nodes in the order they are listed, if we order by timestamp, then the charlie node will be loaded first. Leveraging the child values to orderBy is very flexible.
Also, you can limit the set of data you are loading in with startingAt and endingAt. So for example, you want to load nodes starting at node 10 and ending at node 14. Easily done with non-array JSON data but not easily done if it's stored in an array as the entire array must be read in.

In freebase MQL, how do I query for properties that may not have content?

Say I'm trying to get properties from a film. I can run the following which will return an array of actors:
{"type":"/film/film","id":"/m/05ggnq",
"starring":[{"mid":null,"actor":null,"character":null}]
}
However, when I try to query for another property that may or may not exist ("story_by") I simply get back an empty 200 response.
{"type":"/film/film","id":"/m/05ggnq", "story_by":[{"mid":null}],
"starring":[{"mid":null,"actor":null,"character":null}]
}
How am I suposed to search for both of these properties at the same time?
You can do this using the optional directive like this:
{
"type": "/film/film",
"id": "/m/05ggnq",
"story_by": [{
"mid": null,
"optional": true
}],
"starring": [{
"mid": null,
"actor": null,
"character": null
}]
}

Resources