Tag events in JS

When an interesting event occurs in your Javascript or Windows 8 JS application, tag it using these instructions.

You may want to collect additional data about some events, such as how many lives a player has or the last action a user took before clicking on an advertisement. Collect this additional data with the second form of tagEvent, which takes a dictionary of key/value pairs, or attributes, along with the event name.
  1. Tag a single event with no attributes by adding the following line of code, where “Options Saved” is a string describing the event.
    … existing JavaScript action...
                localyticsSession.tagEvent("Options Saved");
  2. If you want to add attributes, modify the tag to include a dictionary of key/value pairs.
    localyticsSession.tagEvent(
      "Event Name", {“AttributeName”: attributevalue, “AttributeName2”: attributevalue2});
    For example, recording an article view in a news application might look like this:
    localyticsSession.tagEvent ("Article View", {“Page Name”:Baseball-Headlines , “Section”: “sports”});