Return to Video

Sending Events to Tag Manager Quiz

  • 0:01 - 0:03
    Now that we've got the daily
    special working in our app,
  • 0:03 - 0:06
    we can use Google Analytics
    to to see how people use it.
  • 0:06 - 0:09
    For the Show Daily sSpecial activity,
  • 0:09 - 0:12
    we'll send our tracking
    data to Tag Manager.
  • 0:12 - 0:16
    And then Tag Manager will
    forward it to Google Analytics.
  • 0:16 - 0:21
    You already saw that you can put data
    into the dataLayer using the push
  • 0:21 - 0:24
    method, specifying the key and
    the value.
  • 0:24 - 0:29
    When we used it, the push values into
    the dataLayer, keyed by food pref.
  • 0:30 - 0:33
    In this case vegan is a value,
    food pref is the key.
  • 0:34 - 0:36
    Put an event in the dataLayer
    is very similar.
  • 0:37 - 0:42
    You can call dataLayer.push,
    specifying event as the key.
  • 0:42 - 0:45
    And then you'll need to
    pass a bunch of other stuff
  • 0:45 - 0:47
    to pass the parameters for the event.
  • 0:47 - 0:52
    In this case the key absolutely
    must be exactly "event," however,
  • 0:52 - 0:55
    it's easier to use
    the pushEvent method instead.
  • 0:55 - 0:58
    This method makes it easier to
    pass parameters for the event.
  • 0:58 - 1:01
    You need to pass the eventName, and
  • 1:01 - 1:06
    you pass extra data using the mapOf
    method, specifying key value pairs.
  • 1:07 - 1:13
    Now, each of these keys corresponds to
    a dataLayer variable in Tag Manager.
  • 1:13 - 1:15
    Let's see what this means
    in practical terms.
  • 1:15 - 1:18
    In the code for our app,
    in the main activity,
  • 1:18 - 1:21
    in the method that gets called
    to show the daily special,
  • 1:21 - 1:24
    we can add the code to put in
    an event in the dataLayer.
  • 1:24 - 1:28
    Get the dataLayer and
    push an event onto it.
  • 1:28 - 1:32
    In this case, we're pushing the event
    open screen and we're setting
  • 1:32 - 1:37
    Show Daily Special as the value of
    the screen name key, and this means
  • 1:37 - 1:43
    that the screen-name dataLayer variable
    will get the value, Show Daily Special.
  • 1:43 - 1:47
    So, go ahead and add the code to your
    app to push an event into the dataLayer
  • 1:47 - 1:50
    when the user clicks
    the Show Daily Special button.
  • 1:50 - 1:55
    In Main Activity you're going to update
    the method startShowDailySpecialActivity
  • 1:55 - 1:59
    to push the openScreen event
    into the dataLayer, and
  • 1:59 - 2:02
    you need to set the value
    of the screen-name kry.
  • 2:02 - 2:06
    You'll create the new screen-name
    dataLayer variable in tag manager
  • 2:06 - 2:07
    in the next section.
Cím:
Sending Events to Tag Manager Quiz
Leírás:

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

English subtitles

Felülvizsgálatok Compare revisions