Expand my Community achievements bar.

SOLVED

Using _satellite.getVar() value in variable editor of AEP Web SDK Update variable Type

Avatar

Level 4

Hi Team,

 

I have created a data element using _satellite.setVar("linkText","clickText") in the custom code of the rule. 

Then I am using percent (%) syntax reference this in AEP web SDK update variable type as shown below in eVar50

ankitagarwal05_0-1716832100159.png

When I check the value in network call I am seeing it as %linkText%

ankitagarwal05_1-1716832183778.png

Can you please guide how we can get the actual value of this data element if I need to update it in the UI. 

As per the document https://experienceleague.adobe.com/en/docs/experience-platform/tags/client-side/satellite-object we should be able to reference _satellite.getVar() in percent(%) syntax under UI.

ankitagarwal05_2-1716832295553.png

 

 

1 Accepted Solution

Avatar

Correct answer by
Level 6

Hi @bjoern__koth 

 

I've tested your theory but it seems to be working fine at my end.

my set up:

  • a rule to set a data element at page top event using setVar method in custom code.AnkitCh2_0-1716872685416.png

     

  • another rule at dom ready using set variable UI to fetch the value of data element set in the previous call using setVar.AnkitCh2_1-1716872810359.png

     

    AnkitCh2_2-1716872851233.png

     

  • I am getting the value in the omnibug call.

    AnkitCh2_3-1716872898938.png

     

I used adobe analytics extension currently facing some issues with web sdk after the new updates with update variable action type.

 

@ankitagarwal05  if you're not getting the %link text% value there might be chance the rule is getting fired earlier before value is being set to data element trying delaying the rule action.

 

Also are you setting the data element using the custom code in the same rule in which you are trying to access it "web sdk link click test" - mentioned in the screenshot?

View solution in original post

12 Replies

Avatar

Level 9

HI @ankitagarwal05 ,


Update: removed my false assumption to avoid confusion

 

For your concrete example, if you are talking about a link that was clicked which properties you want to access, have a look at Jim Gordon's Adobe Launch Cheat Sheet

I think this section should answer your question

bjoern_k_0-1716834182949.png

 

Cheers

 

P.S. as a side note, looking at your data.__adobe XDM data.

May I ask why you are not using the "Adobe Analytics ExperienceEvent Full Extension" field group to automatically map all of your analytics data without the need for processing rules in Adobe Analytics? If you are using the old school "eVar50" and "events", you could save some setup time.

 

https://experienceleague.adobe.com/en/docs/experience-platform/xdm/field-groups/event/analytics-full...

Avatar

Level 4

Thank you for your response, wondering why Adobe has mentioned in the documentation that we can utilize percent (%) syntax to reference variables for many form fields in your tag implementation, reducing the need to call _satellite.getVar().

 

With the data object there is no need to use Schema/field group while migrating to AEP Web SDK and these eVars and events are automatically mapped in Data object.

Data object variable mapping to Adobe Analytics - https://experienceleague.adobe.com/en/docs/analytics/implementation/aep-edge/data-var-mapping 

Avatar

Level 9

So yeah, my suggestion is avoid setVar and rather have a dedicated Data Element for it, potentially with custom code if needed.

 

have you checked the direct access to link properties like innerText etc. that I've mentioned?

Avatar

Level 9

Whaaat, haven't seen the data.__adobe.analytics mapping at all before! This must be new, thanks for clarifying!!

Avatar

Correct answer by
Level 6

Hi @bjoern__koth 

 

I've tested your theory but it seems to be working fine at my end.

my set up:

  • a rule to set a data element at page top event using setVar method in custom code.AnkitCh2_0-1716872685416.png

     

  • another rule at dom ready using set variable UI to fetch the value of data element set in the previous call using setVar.AnkitCh2_1-1716872810359.png

     

    AnkitCh2_2-1716872851233.png

     

  • I am getting the value in the omnibug call.

    AnkitCh2_3-1716872898938.png

     

I used adobe analytics extension currently facing some issues with web sdk after the new updates with update variable action type.

 

@ankitagarwal05  if you're not getting the %link text% value there might be chance the rule is getting fired earlier before value is being set to data element trying delaying the rule action.

 

Also are you setting the data element using the custom code in the same rule in which you are trying to access it "web sdk link click test" - mentioned in the screenshot?

Avatar

Level 4

Hi @Ankit_Chaudhary 

 

Yes, I am setting up the data element using the custom code in the same rule and then using it to update eVar in Web SDK update variable UI. 

ankitagarwal05_0-1716900205117.png

ankitagarwal05_1-1716901538881.png

I did do the console.log of the Data element but it is coming after sendEvent/interact call fired.

ankitagarwal05_2-1716901845026.png

 

Avatar

Level 6

Have you tried delaying the update variable and send event action?

Avatar

Level 4

Yes, it worked after applying the delay. Earlier this was disabled on my property settings.

ankitagarwal05_0-1716906150390.png

Is it the best practice to apply delay or rule components in sequence?

I appreciate your help here.

Avatar

Level 9

setVar should be synchronous, so I don't see why the custom code should not finish before calling the update variable.

 

You could try to wrap your custom code with the setVar in a Promise and see whether this makes a difference.

return new Promise ((resolve,reject) => {
  _satellite.setVar("linkText","clickText");
  resolve();
});

 

See also https://www.datanalyst.info/web_analytics/adobe-launch/launch-async-sequential/ 

 

But again, I do not think this should be an asynchronous function that is finished executing later than the update variable call.

Avatar

Level 6

Hi @bjoern__koth 

I believe setVar function itself is synchronous however the custom code action defined in the rule is talking more to set the data element meanwhile the next actions are executing and conflicting with it as rule sequencing was not enabled for the property.

 

Avatar

Level 9

Maybe Adobe should rethink their UI a little. If in @ankitagarwal05 's example without sequencing, the actions are separated with "THEN"

bjoern_k_0-1716955443210.png

whereas with sequencing enabled, it say "WAIT, THEN", both cases sound very similar and may lead to false assumptions.

bjoern_k_1-1716955517369.png

 

Maybe in this case, setVar is actually executed in time then, if "update variable" and "send event" are both asynchrously called, the update of the variable likely just has not taken place.

 

Key takeaway: "run rules in sequence" is your friend not only in this case. Can lead to timing issues in the bigger picture though.