6. Events Extra

 

 

 

  • Lesson Overview

     

    Transcription

    Welcome to the training video on setting up events within the mobile UI. My name is Richard Jones and I'm a mobile implementation consultant at InsightOn. We previously went through setting up the mobile event, and with that done, we can now pick out the data that we need. As mentioned in the last video, if you select a lifecycle event, we automatically create a data token relevant to the event. So if we select Page View, we get a token created given us the Page name.

    Also, if we select Click, we get a token created giving us the name of the button clicked. A similar system is in place when tracker events are selected, although in this case we can pick up a lot more data. When selecting Page View, Event or Conversion, there are two automatically created tokens. The first token will be the first argument that is put into the tracker call. So this is usually the page name, event name, or conversion name.

    The second token is the second argument that you put into the tracker call. This will be a JSON object containing all the data that you want tracked for this event. You also have the ability to create subtokens of your data. These will help the implementation of your data into your tags with the ability to call the subtokens directly in JavaScript or via Data Definitions within Manage. To create a subtoken, you select the Data token and click on the plus icon.

    This will bring up the Create Token screen. In this example, I'll be creating a token for a product ID and product price. As you can see, the property is automatically populated, but you will need to change this to match the structure of your data. More information on Data tokens is available in the next video.

    The next section is the global tokens which we talked about in the previous event video. For this example, I'll select app, build device ID and launch count. Click Save and you can see all selected global tokens. Now show here in blue. The final pass of Data tokens is the Custom tokens.

    This can be considered a more advanced way of collecting data and are typically used with the Legacy setup when using injected events. They collect data by running a set of native instructions called opcodes to retrieve data when an injected event is fired. Whilst this is primarily used in the Legacy system when injecting events, it does have benefits outside of this, such as firing JavaScript directly when the event is called. We can start by selecting Create Custom Token. The first thing we need to do is enter the name of the token.

    This will be used to identify the token we are creating and is used to access it within the Insight and Data layer. The next option we have is the type of token it will be. We have three options here custom, Json, and String. Custom is used when we don't have a particular type of data that will be returned. It also adds a tick box near the bottom here which when selected will save anything we are doing here to the data layer.

    Json is used when we are collecting the Json object. These can have subtokens that will allow us to split the data into individual tokens for each element within the object allowing us easier integration within our tags. The final option is String and this is used when we want to return a string. The final section are the opcodes. These create a line of code that runs natively on the mobile device.

    They can be used to achieve a number of things such as access to the object, the methods that triggered the event and the method arguments. You can also call Methods Access properties and execute snippets of JavaScript code. I'm sure you can tell already that as we are running native code here, you need an understanding of the coded language used within the app and is why this tends to be left for legacy use. For this demo we will simply add a JavaScript console log line which can be useful to initially debug that the event is working. To do this we first give it a name.

    Let's give it a name of custom JS token for now. Next we select the custom type and uncheck save to data layer. This is because we are not actually saving any value to be used later. We are simply going to print a message to the console. Next, within the opco section we select call JS function.

    This will bring up a box for us to enter JavaScript. In here we can simply enter a console log line that prints out hello world. With that done we can select Create token in the bottom right. What this token will now do is simply print out the line hello world to the console when the event is triggered and can be useful when testing because if it's printed out, we know that the event is triggering successfully. You can get more details on how to connect to the console in the testing and debugging videos.

    With that final part complete, we now have the autogenerated tokens that gather the page name and page data. The global tokens for app build, device ID and launch count along with the token that prints out Hello World when the event is triggered. Thank you for joining me for this video. Please join me in the next video where we will go further with integrations and tags. If you have any questions then please contact our support team via Support@insighton.com.

     

Feeling confident in your Ensighten Manage skills? Take our Ensighten Certified Professional - Mobile Quiz to see how you stack up!