-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
070ca77
commit 09bd7c3
Showing
1 changed file
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Google Analytics | ||
### fnGoogleConnector | ||
get data from Google analytics, (un)comment out variables | ||
|
||
```C# | ||
let | ||
fnGetGAData = ( //fnGetGAData: see code to check dimensions/measures | ||
AccountId as text, // Account GUID | ||
PropertyId as text, // Property GUID | ||
ViewId as text // View GUID | ||
) => | ||
let | ||
Source = GoogleAnalytics.Accounts(), | ||
Account = Source{[Id=AccountId]}[Data], | ||
Property = Account{[Id=PropertyId]}[Data], | ||
View = Property{[Id=ViewId]}[Data], | ||
|
||
//** DIMENSIONS **// | ||
// Date Dimension | ||
vDate = {Cube.AddAndExpandDimensionColumn, "ga:date", {"ga:date"}, {"Date"}}, | ||
vUserType = {Cube.AddAndExpandDimensionColumn, "ga:userType", {"ga:userType"}, {"User Type"}}, | ||
vGender = {Cube.AddAndExpandDimensionColumn, "ga:userGender", {"ga:userGender"}, {"Gender"}}, | ||
vAge = {Cube.AddAndExpandDimensionColumn, "ga:userAgeBracket", {"ga:userAgeBracket"}, {"Age"}}, | ||
vSocialNetwork = {Cube.AddAndExpandDimensionColumn, "ga:socialNetwork", {"ga:socialNetwork"}, {"Social Network"}}, | ||
|
||
//** MEASURES **// | ||
// PageViews Measure | ||
vPageViews = {Cube.AddMeasureColumn, "Pageviews", "ga:pageviews"}, | ||
// NewUsers Measures | ||
vNewUsers = {Cube.AddMeasureColumn, "New Users", "ga:newUsers"}, | ||
// Hits Measures (Users) | ||
vUsers = {Cube.AddMeasureColumn, "Users", "ga:users"}, | ||
|
||
//** CREATE QUERY **// | ||
addDimensions = Cube.Transform(View, | ||
//You have to susbstitute this part with a your new query (dimensions, metrics) and create a new function for each query. Just create the query as a simple table and copy it here. | ||
{ | ||
// vSocialNetwork, | ||
// vAge, | ||
// vGender, | ||
// vUserType, | ||
vDate, | ||
vPageViews, | ||
vUsers, | ||
vNewUsers | ||
|
||
}) | ||
in | ||
addDimensions | ||
in fnGetGAData | ||
``` |