Multiple Context Data in a single trackState Or trackAction | Community
Skip to main content
Level 2
December 6, 2017
Solved

Multiple Context Data in a single trackState Or trackAction

  • December 6, 2017
  • 2 replies
  • 3030 views

Hello,

I am looking at the different documentation for the iOS and Android SDK and I am not sure if it is possible to send different context variable within the same State or Action.

Documentation State for iOS & Android:

It seems incredible that it is not possible, but how would you write that ?

@Override

public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);

    setContentView(R.layout.main);

    // Adobe - track when this state loads

    HashMap<String, Object> exampleContextData1 = new HashMap<String, Object>();

    exampleContextData1.put("myapp.login.LoginStatus", "logged in");

    HashMap<String, Object> exampleContextData2 = new HashMap<String, Object>();

    exampleContextData2.put("myapp.login.Template", "templateB");

    Analytics.trackState("Home Screen", exampleContextData1,exampleContextData2);

}

Any help, would be appreciated.

Thanks

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by jhammons-1

Put each context data value in the same HashMap, and then pass one HashMap to the track call:

    // Adobe - track when this state loads  

    HashMap<String, Object> exampleContextData1 = new HashMap<String, Object>(); 

    exampleContextData1.put("myapp.login.LoginStatus", "logged in"); 

    exampleContextData1.put("myapp.login.Template", "templateB"); 

 

    Analytics.trackState("Home Screen", exampleContextData1);

2 replies

jhammons-1Adobe EmployeeAccepted solution
Adobe Employee
December 6, 2017

Put each context data value in the same HashMap, and then pass one HashMap to the track call:

    // Adobe - track when this state loads  

    HashMap<String, Object> exampleContextData1 = new HashMap<String, Object>(); 

    exampleContextData1.put("myapp.login.LoginStatus", "logged in"); 

    exampleContextData1.put("myapp.login.Template", "templateB"); 

 

    Analytics.trackState("Home Screen", exampleContextData1);

Level 2
December 8, 2017

Thanks for your answer.
It exactly what I was looking for.