Internal search engine

 

Foreword

AT Internet’s SDK allows you to tag your application’s internal search engine. By doing so, you can see which keywords were entered, as well as the results screen number, and the position of the item selected by the user.

 

Get off to a good start

Once your tag is initialised, you can add the search information to your screen or gesture hit.

If you want to use variables, be sure to import ATInternet, Tracker, Screen and/or Gesture, InternalSearch classes in your Activity.

 

Tagging

The Screen and Gesture objects make an InternalSearch method available.

This method takes two parameters :

  • keywordLabel of String type indicates search keyword
  • resultScreenNumber of int type indicates the screen number where item was selected by user

This method sends an InternalSearch-type object.
In order to track a search result page, you won’t add the resultPosition property.

 

Tagging example

  1. Search screen tagging
    package com.atinternet.atinternetdemo;
    
    import android.app.Activity;
    import android.os.Bundle;
    
    import com.atinternet.tracker.ATInternet;
    import com.atinternet.tracker.Tracker;
    
    
    public class SearchActivity extends Activity {
    
        private Tracker tracker;
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
            tracker = ATInternet.getInstance().getDefaultTracker();
        }
    
        @Override
        protected void onResume() {
            super.onResume();
            Screen s = tracker.Screens().add("Search Screen");
            s.InternalSearch("keyword", 2);
            s.sendView();
        }
    }
  2. Result click tagging
    package com.atinternet.atinternetdemo;
    
    import android.app.Activity;
    import android.os.Bundle;
    
    import com.atinternet.tracker.ATInternet;
    import com.atinternet.tracker.Tracker;
    
    
    public class SearchActivity extends Activity {
    
        private Tracker tracker;
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
            tracker = ATInternet.getInstance().getDefaultTracker();
        }
    
        @Override
        protected void onClick(View v) {
            super.onResume();
            Gesture gesture = tracker.Gestures().add("SearchResult");
            gesture.InternalSearch("keywordLabel", 1, 7);
            gesture.sendSearch();
    
            //OR
    
            Gesture gesture = tracker.Gestures().add("SearchResult");
            gesture.InternalSearch("keywordLabel", 1)
                    .setResultPosition(7);
            gesture.sendSearch();
        }
    }
 

InternalSearch class

 

Properties

NameTypeDefault valueDescription
keywordStringnullGets or sets keywords entered during the search
resultScreenNumberInt-1 (>= 2.3.4 –> 1)Gets or sets the screen number containing the item on which the user clicked
resultPositionInt-1Gets or sets the position of the item on which the user clicked
Last update: 05/04/2018