Return to Video

Create a Container Variable

  • 0:00 - 0:05
    Now you have a Tag Manager
    account with its first container.
  • 0:05 - 0:07
    Mine's called DailySpecialContainer.
  • 0:07 - 0:11
    The next step is to put
    something into the container and
  • 0:11 - 0:12
    then use it in your app.
  • 0:12 - 0:14
    So the steps are like this.
  • 0:14 - 0:17
    In Tag Manager, create a variable.
  • 0:17 - 0:20
    And then, publish the container.
  • 0:20 - 0:26
    Then in your app code, you write
    the code to get and use the variable.
  • 0:26 - 0:30
    Then you update the variable,
    publish the container again.
  • 0:30 - 0:32
    In your app code, well,
  • 0:32 - 0:36
    you already wrote the code, so
    you don't need to do anything.
  • 0:36 - 0:39
    Your app will automatically
    get the latest value.
  • 0:39 - 0:42
    Now lets look at how to create
    the daily special variable
  • 0:42 - 0:44
    in the Tag Manager dashboard.
  • 0:44 - 0:48
    So make sure you're in the container
    tab and click Variables.
  • 0:48 - 0:53
    You'll see that tag manager defines
    a bunch of pre-defined variables, and
  • 0:53 - 0:55
    you can make use of these
    variables in your app.
  • 0:55 - 0:58
    For example,
    you can use a device name, so
  • 0:58 - 1:01
    that different devices use a different
    background image in your app.
  • 1:03 - 1:06
    For now though we're going to
    define our own custom variable.
  • 1:06 - 1:12
    To create custom variable, click New
    in the User-Defined Variables section.
  • 1:12 - 1:14
    Whoa, there are a lot of variable types.
  • 1:14 - 1:19
    You can read about what they each
    are in the online help for Tag Manager.
  • 1:19 - 1:22
    For now, we want a Value Collection.
  • 1:22 - 1:25
    Choose Type, Value Collection,
    that's what we want.
  • 1:25 - 1:27
    But first,
    you need to name the variable, and
  • 1:27 - 1:31
    this is going to be the DailySpecial,
    and now we need to configure it.
  • 1:31 - 1:34
    So configuring the variable basically
    means specifying the value.
  • 1:35 - 1:39
    And for a value collection,
    it's a key value pair.
  • 1:39 - 1:40
    It's actually a list of key value pairs.
  • 1:40 - 1:44
    You could put as many key
    value pairs as you want.
  • 1:44 - 1:47
    But for now, let's just do one for
    the DailySpecial.
  • 1:47 - 1:52
    So since it's a key value pair,
    let's have the key be daily-special and
  • 1:52 - 1:55
    enter a daily special of your choice.
  • 1:55 - 2:00
    And you need to begin and end
    the value with open and closed braces.
  • 2:00 - 2:03
    We're going to save the advanced
    settings for later.
  • 2:03 - 2:08
    We need to Continue, and
    we need to choose when to enable it.
  • 2:08 - 2:10
    Well, we want to always enable it.
  • 2:10 - 2:11
    So create variable,
  • 2:11 - 2:16
    I now see in the User-Defined Variables
    section, I've got one variable.
  • 2:16 - 2:20
    However, it's not enough to just
    define or update the variable.
  • 2:20 - 2:25
    If you want your app to get the latest
    values, you need to publish the changes.
  • 2:26 - 2:28
    So we press the Publish button,
  • 2:28 - 2:33
    it double checks if we really want to
    publish and so I'll say Publish Now.
  • 2:36 - 2:36
    Oh, I got an error.
  • 2:36 - 2:41
    So this is one of the nice things,
    is that the publish process does catch
  • 2:41 - 2:46
    errors in your key value pairs,
    in your value collection list variables.
  • 2:46 - 2:48
    So let's go fix that.
  • 2:48 - 2:55
    I fixed the key value pairs in my
    variable, press Continue, and I save it.
  • 2:55 - 3:00
    Now that I saved it,
    I'll publish again, Publish Now, and
  • 3:00 - 3:02
    yay, success my changes are now live.
  • 3:02 - 3:06
    Of course I'm not actually doing
    anything with this variable, but
  • 3:06 - 3:08
    we'll get to that in seconds.
  • 3:09 - 3:12
    Go ahead and create the variable for
    the daily special.
  • 3:12 - 3:17
    So make sure that you set your variable
    name, type is set to Value Collection,
  • 3:18 - 3:23
    that you've configured the variable,
    and entered the key value pair for
  • 3:23 - 3:24
    the Value Collection.
  • 3:26 - 3:29
    Enable, Always and create the variable.
  • 3:29 - 3:34
    Then when your variable's created,
    make sure you publish your container.
  • 3:35 - 3:38
    And next, we're going to look at how
    to download the default container.
Cím:
Create a Container Variable
Leírás:

more » « less
Video Language:
English
Team:
Udacity
Projekt:
UD876-2 - Google Play Services - Analytics
Duration:
03:39

English subtitles

Felülvizsgálatok Compare revisions