Context data and variables

Avatar

Avatar
Validate 1
Level 2
andersonjh
Level 2

Likes

5 likes

Total Posts

23 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
View profile

Avatar
Validate 1
Level 2
andersonjh
Level 2

Likes

5 likes

Total Posts

23 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
View profile
andersonjh
Level 2

10-09-2019

We had a app developer here for a couple setting up adobe tracking for our new app (before I came onboard, no idea what happened).

He left us with about 30 or so events and documentation that looks like this:

       

event55Select Your Installation Manuallya.action=team.selectyourinstallationmanuallySelect Your Installation Manually[contextData setObject:@("select your installation manually" forKey:@"selectyourinstallationmanually"];Toggle
event76Enable SMS Notificationsa.action=team.enablesmsnotificationsEnable SMS Notifications[contextData setObject:@("enable sms notifications" forKey:@"team.enablesmsnotifications"];Toggle
event59Promotional Updatesa.action=promotionalupdatesPromotional Updates[contextData setObject:@("promotionalupdates" forKey:@"team.promotionalupdates"];Checkbox

But my dev team said that [contextData setObject:@("enable mail notifications" forKey:@"aafes.mailnotifications"]; doesn't make sense and wouldn't implement it. I've also never seen it written this way but wanted to see if it does to anyone else or what is the right way to this up? (I've substituted "team" for the company name)

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Boost 5
Employee
phuo1032
Employee

Likes

5 likes

Total Posts

3 posts

Correct reply

1 solution
Top badges earned
Boost 5
Boost 3
Boost 1
Affirm 1
View profile

Avatar
Boost 5
Employee
phuo1032
Employee

Likes

5 likes

Total Posts

3 posts

Correct reply

1 solution
Top badges earned
Boost 5
Boost 3
Boost 1
Affirm 1
View profile
phuo1032
Employee

11-09-2019

Hi jha0024, the example above you provided above would be the correct syntax. For example: instead of doing

[contextData setObject:@"login_status" forKey:@"mobile.login_status"];

you may do

contextData['mobile.login_status'] = 'login_status'

Answers (7)

Answers (7)

Avatar

Avatar
Boost 5
Employee
phuo1032
Employee

Likes

5 likes

Total Posts

3 posts

Correct reply

1 solution
Top badges earned
Boost 5
Boost 3
Boost 1
Affirm 1
View profile

Avatar
Boost 5
Employee
phuo1032
Employee

Likes

5 likes

Total Posts

3 posts

Correct reply

1 solution
Top badges earned
Boost 5
Boost 3
Boost 1
Affirm 1
View profile
phuo1032
Employee

11-09-2019

1. It depends on where you are inserting this line of code in the application. The contextData variable may be a field of another object (s or p). The developers should recognize whether they need it or not.

2. Yes, I used 'login_status' in my example to be consistent with the String used in the setObject call from Objective-C. In actual implementation it is likely that it is a value of current login status, for this particular example.

Avatar

Avatar
Validate 1
Level 2
andersonjh
Level 2

Likes

5 likes

Total Posts

23 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
View profile

Avatar
Validate 1
Level 2
andersonjh
Level 2

Likes

5 likes

Total Posts

23 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
View profile
andersonjh
Level 2

11-09-2019

Awesome. Thanks for your help on this.

Avatar

Avatar
Boost 3
Level 1
jha0024
Level 1

Likes

3 likes

Total Posts

3 posts

Correct reply

0 solutions
Top badges earned
Boost 3
Boost 1
View profile

Avatar
Boost 3
Level 1
jha0024
Level 1

Likes

3 likes

Total Posts

3 posts

Correct reply

0 solutions
Top badges earned
Boost 3
Boost 1
View profile
jha0024
Level 1

11-09-2019

Thanks. 2 questions. do i need to have s. or p. etc in front of the contextData? and = 'login_status" can be replaced by whatever term we define as the login status or not? such as 'Logged In" or does it need to be = 'login_status'  ?

Avatar

Avatar
Boost 3
Level 1
jha0024
Level 1

Likes

3 likes

Total Posts

3 posts

Correct reply

0 solutions
Top badges earned
Boost 3
Boost 1
View profile

Avatar
Boost 3
Level 1
jha0024
Level 1

Likes

3 likes

Total Posts

3 posts

Correct reply

0 solutions
Top badges earned
Boost 3
Boost 1
View profile
jha0024
Level 1

11-09-2019

Great to know.

It's actually being written in React Native. Do you know the syntax for that?

Avatar

Avatar
Boost 5
Employee
phuo1032
Employee

Likes

5 likes

Total Posts

3 posts

Correct reply

1 solution
Top badges earned
Boost 5
Boost 3
Boost 1
Affirm 1
View profile

Avatar
Boost 5
Employee
phuo1032
Employee

Likes

5 likes

Total Posts

3 posts

Correct reply

1 solution
Top badges earned
Boost 5
Boost 3
Boost 1
Affirm 1
View profile
phuo1032
Employee

11-09-2019

Hi jha0024​ - May I ask if you are asking about the Android or iOS app implementation? If it is iOS, is your application written in Swift or Objective-C.

[contextData setObject] is Objective-C syntax. The example you provided: s.contextData[‘mobile.login_status’] = ‘Logged In’, looks like a Swift syntax.

Avatar

Avatar
Boost 3
Level 1
jha0024
Level 1

Likes

3 likes

Total Posts

3 posts

Correct reply

0 solutions
Top badges earned
Boost 3
Boost 1
View profile

Avatar
Boost 3
Level 1
jha0024
Level 1

Likes

3 likes

Total Posts

3 posts

Correct reply

0 solutions
Top badges earned
Boost 3
Boost 1
View profile
jha0024
Level 1

11-09-2019

Absolutely. We're trying to implement context data variables into our mobile app. Historically, I've only seen script like this,

s.contextData[‘mobile.login_status’] = ‘Logged In’;

but the consultant gave us implementation specs that looked like the first post. I'm not a developer so I want to be careful but, in my understanding, his technical implementation specs can't actually be used. Meaning, we can't set a variable for when people login as

[contextData setObject:@("login_status" forKey:@"mobile.login_status"];

Or can we? Which of these two examples can actually be coded into the app and set as a data element? Or can neither be used?

Avatar

Avatar
Affirm 5
Employee
praschetan
Employee

Likes

10 likes

Total Posts

28 posts

Correct reply

6 solutions
Top badges earned
Affirm 5
Give Back 3
Give Back
Publish 3
Publish 1
View profile

Avatar
Affirm 5
Employee
praschetan
Employee

Likes

10 likes

Total Posts

28 posts

Correct reply

6 solutions
Top badges earned
Affirm 5
Give Back 3
Give Back
Publish 3
Publish 1
View profile
praschetan
Employee

11-09-2019

Hi andersonjh​ - apologies for the delayed response. I'm not completely sure what you're trying to do. Can I trouble you provide a little more context and perhaps some end-results of what you're trying to accomplish so we can get you a prompt response?