Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

How to pass date parameters to Google Analytics Macro?

narula8
7 - Meteor

Hello Experts,

Can you please help me figure out how to pass date with variables in GA connector. 

Basically, I want to parameterize it and schedule a dataflow to run for each day sequentially for last 90 days.

Not all once but one by one ( day by day ).

 

 

 

2 REPLIES 2
Hammad_Rashid
11 - Bolide

To pass date parameters to the Google Analytics Macro, you need to use the Control Parameter tool and the Action tool in your workflow. The Control Parameter tool allows you to create a user-defined input that can be used to change the value of another tool. The Action tool allows you to specify how the value of the Control Parameter tool will affect the target tool.

 

In your case, you want to change the value of the End Date field in the Google Analytics Macro to a variable date. To do this, you can follow these steps:

  • Drag a Control Parameter tool from the Interface tool category onto your canvas.
  • Configure the Control Parameter tool as follows:
    • Name: End Date
    • Label: Enter the end date for the query (yyyy-mm-dd)
    • Data Type: Date
    • Default Value: Choose a default date value for your query, such as DateTimeToday()
  • Connect the Control Parameter tool to the Google Analytics Macro using the Q anchor.
  • An Action tool will be automatically added to your workflow. Configure the Action tool as follows:
    • Target Tool: Google Analytics Macro
    • Target Field: End Date
    • Action: Replace a specific string
    • Replace: Choose the string that represents the end date in the macro, such as DateTimeToday()
    • With: Value
  • Save your workflow as a macro (.yxmc file) and test it by running it in wizard mode or by calling it from another workflow.

To schedule your dataflow to run for each day sequentially for the last 90 days, you can use the Generate Rows tool and the Batch Macro tool in your workflow. The Generate Rows tool allows you to create a series of dates based on a start date and an end date. The Batch Macro tool allows you to run a macro multiple times, passing a different value from the input data each time.

To do this, you can follow these steps:

  • Drag a Generate Rows tool from the Preparation tool category onto your canvas.
  • Configure the Generate Rows tool as follows:
    • Create New Field: End Date
    • Data Type: Date
    • Expression: DateTimeAdd([CurrentField], -1, “days”)
    • Condition: [CurrentField] > DateTimeAdd(DateTimeToday(), -90, “days”)
    • Start Value: DateTimeToday()
  • Connect the Generate Rows tool to the Batch Macro tool using the D anchor.
  • Drag your macro onto the canvas and connect it to the Batch Macro tool using the M anchor.
  • Configure the Batch Macro tool as follows:
    • Group By: None
    • Control Parameter: End Date
    • Output Mode: Append all output rows
  • Connect the Batch Macro tool to an Output Data tool or any other tool that you want to use to process the output data.

 

narula8
7 - Meteor

@Hammad_Rashid  : Hey, thanks a prompt response. However, my query is more on how to pass these date parameters to GA connector.

Can you please advice.

 

 

Labels