English 字幕

← Triggers and Variables Solution


Showing Revision 3 created 05/25/2016 by Udacity Robot.

  1. So how did you do with this quiz?
  2. I know that the whole variables and
    triggers thing can be a bit confusing,
  3. with variables depending on triggers,
    which depend on variables, anyway.
  4. So the first one,
  5. the value of a data layer variable
    is set by code in your app, is true.
  6. So if you remember,
    we set the food_pref value in our code.
  7. The value of a value collection
    variable is set by you
  8. in the Tag Manager interface,
    and that is correct.
  9. So if we look at one of our variables,
    Value Collection variable,
  10. and this is where we set
    the value of that variable.
  11. And it takes a series of key and
    value combinations.
  12. We've only been using one key
    value combination per variable.
  13. A value collection variable cannot
    include a key that any other value
  14. collection variable uses.
  15. Well that's just wrong.
  16. We've been using
    the daily special key and
  17. a bunch of different variables,
    not just this one.
  18. The value of a key in
    a value collection variable
  19. can be triggered by the value
    of other variables.
  20. And that's true, but of course it's
    done through the use of triggers.
  21. Here again, in our daily-special-fish
    variable, we have the fish trigger, and
  22. the fish trigger depends on
    the value of the food pref variable.
  23. So here we have a variable influencing
    the value of another variable.
  24. A value collection variable can be
    triggered by at most, one trigger?
  25. Wrong.
  26. So we look at, for
  27. example, daily-special-vegetarian,
    you can add multiple triggers.
  28. I can add another one if I wanted.
  29. It's important to understand
    that any of these triggers
  30. will set the value of this variable.
  31. They don't have to all trigger.
  32. Just one of them has to trigger.
  33. And yes, you can create a trigger that
    fires when the data layer variable
  34. has a certain value.
  35. So, if you look to our
    vegetarian trigger,
  36. this here food pref is a data layer
    variable and when it has this value,
  37. vegetarian, then this trigger will fire.
  38. And you can create a trigger that
    fires when the app is running on
  39. a device with a specific
    screen resolution.
  40. You can create triggers that fire based
    on any of the built-in variables,
  41. of which screen resolution is one.
  42. And a trigger can have multiple
    criteria that determine when it fires.
  43. You can add multiple
    conditions to a trigger.
  44. Just keep pressing the plus button.
  45. It's important to notice though,
  46. that the trigger will only fire when
    all of the conditions are true.
  47. This is not an or thing,
    this is an and thing.
  48. So they must all be true for
    the trigger to fire.
  49. So how did you do with the quiz?
  50. Have you got your triggers and
    variables straight?