How to Analyze Advertising Trackers with Different Variables for Each Campaign

From Q
Jump to navigation Jump to search

Where each advertising campaign is stored with separate variables, there are three strategies that can be employed. The first is to repeat the setup for each new campaign (this is the most time consuming and most error-prone approach). The second approach, which is the most technical approach but likely the most productive in the long-run is to write a QScript. The third approach is to use JavaScript, as follows:

  • Create a list of all the advertisements and assign a unique value to each advertisement (e.g., 1 = description of first ad, 2 = description of second ad).
  • In the Variables and Questions tab select Insert Variable(s) > JavaScript Variable > Numeric
Name: advertisement.
Label: Advertisement Number

//1 = description of first ad
//2 = description of second ad

Note that the first line contains a 1 and the remaining lines just show the list of advertisements and unique values, where the // indicates that it is a comment rather than JavaScript.
  1. Use Copy and Paste Question(s) > Linked to copy the questions of the first advertisement.
  2. Manually edit each of the variables in the copied questions using an if statement, so that when you edit the Expression in the advertisement variable, all the linked questions automatically refer to the correct variables. These if statements will need to be updated every time a new campaign is added.
  3. Create any tables and new variables required to analyse the advertisement.
  4. When you wish to change advertisement, then change the value in the Expression in advertisement to the advertisement of interest. This will cause any variables and tables to automatically update.