Utilisation of dispatch() (SDKs)



This article explains in detail how the dispatch method works, ONLY FOR SDKs.




What is dispatch?

The dispatch is a feature implemented in the SDKs allowing you to send all tagging data all at once – as opposed to sendView for screens, or sendTouch for gestures, for example, which only send data of their respective types. However, using dispatch requires some specific information in order to avoid having problematic hits.


How can it be used?

In order to use this method correctly, it is necessary to understand the system for adding tagging data.

This system relies on the chronological order of code execution. When implementing your application’s tagging, objects will gradually be added as the code is executed:

In this example, all objects added are related to the same type of tagging; therefore, only one hit containing everything will be sent.

However, if we add a Gesture:

If this code is executed, two hits will be sent, in this order:

  1. A first hit containing Gesture and CustomObject
  2. A second hit containing CustomVar and Aisle


Why? Because certain objects are non-essential, and others are final objects.

Non-essential objects are used to enrich data, and final objects will trigger the sending of a hit containing all information compatible with its type at the moment it is executed.

If we take the previous example:

  1. Addition of a CustomVar object, enhancing a Screen
  2. Addition of a CustomObject object, enhancing any type of hit
  3. Addition of a Gesture “final” object -> Sends a hit containing all information compatible with a Gesture, and specifically at this level of code execution, only the added CustomObject is compatible
  4. Addition of an Aisle object, enhancing a Screen
  5. Calling dispatch: if no “final” object is added before its execution, all objects previously added will be sent, with respect to their compatibilities.

Summary table

  • CustomObject (NuggAd,TvTracking)
  • IdentifiedVisitor
  • Publisher
  • SelfPromotion
  • Location
  • CustomVar
  • Order
  • Cart
  • Aisle
  • Campaign
  • InternalSearch
  • DynamicScreen
  • CustomTreeStructure
  • CustomObject (NuggAd,TvTracking)
  • IdentifiedVisitor
  • InternalSearch
Publisher, SelfPromotion
  • CustomObject (NuggAd,TvTracking)
  • Publisher
  • SelfPromotion
  • CustomObject (NuggAd,TvTracking)
  • Product
Was this post helpful?
Last update: 03/05/2016