Hitachi Vantara Pentaho Community Forums
Results 1 to 7 of 7

Thread: Google Analytics - Dynamic Dates

  1. #1
    Join Date
    Sep 2010
    Posts
    2

    Default Google Analytics - Dynamic Dates

    I am using the widget/plug-in 'Read Google Analytics Data' which needs a 'from' and 'to' date but does anyone know how I supply this widget with dynamic dates rather than hard coding it?

  2. #2
    Join Date
    Mar 2008
    Posts
    140

    Default

    The EE step "Google Analytics Input Step" has variable support which will allow you to set a variable from a Job, thusly permitting a dynamic date range.

  3. #3

    Default

    Slawo's Google Analytics plugin also supports variables too:
    http://type-exit.org/adventures-with...in-for-kettle/

    So you can set a variable from a parent job (say in a separate transformation which sets the dates using a "Get System Info" step) and then you can pass start and end date variables to your transformation which gets the data from Google. Just remember to put your dates into the right format (yyyy-MM-dd) before saving them into the variable string.
    Tony, Cloud2Land.com

    Get the latest snapshot Pentaho Data Integration (Kettle) builds from SVN on my blog!
    http://www.cloud2land.com/

  4. #4
    Join Date
    Sep 2010
    Posts
    2

    Default

    Thanks for the solution ...

  5. #5

    Default

    Could you tell me how you achieved this ?

    This is what i'm trying - but i get an error at the GA step -

    <?xml version="1.0" encoding="UTF-8"?><errors xmlns="
    http://schemas.google.com/g/2005"><error><domain>GData</domain><code>invalidParameter</code><location type="parameter">end-date</location><internalReason>Invalid value ''. Values must match the following regular expression: '[0-9]{4}-[0-9]{2}-[0-9]{2}'</internalReason></error><error><domain>GData</domain><code>invalidParameter</code><location type="parameter">start-date</location><internalReason>Invalid value ''. Values must match the following regular expression: '[0-9]{4}-[0-9]{2}-[0-9]{2}'</internalReason></error></errors>


    My Job steps are :

    1) Transformation 1 : Get System Info (start and end date) --> Select Values ( to change format to yyyy-MM-dd) ---> Copy rows to result.
    2) Transformation 2 : Get rows from result (Get field names Start_Date and End_Date) --> Google Analytics Input step (use variable name ${Start_Date} and ${End_Date}) --> Table Output (insert into database)

    What am i missing here ? Its clearly not getting the date from the variables..

    Thanks a lot !


  6. #6
    Join Date
    Apr 2008
    Posts
    4,696

    Default

    Quote Originally Posted by Sue View Post

    1) Transformation 1 : Get System Info (start and end date) --> Select Values ( to change format to yyyy-MM-dd) ---> Copy rows to result.
    2) Transformation 2 : Get rows from result (Get field names Start_Date and End_Date) --> Google Analytics Input step (use variable name ${Start_Date} and ${End_Date}) --> Table Output (insert into database)

    What am i missing here ? Its clearly not getting the date from the variables..

    Thanks a lot !

    To use variables, you need to use the Set Variables step, not the Copy Rows to result step. You're REALLY close to a working solution!

  7. #7

    Default

    That worked ! Thankyou

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.