Expand my Community achievements bar.

AEP Web SDK migration

Avatar

Level 2

Hi everyone, I am new to AEP Web SDK and I am trying to migrate some of our codes.

 

How can I able to implement the manual sending of beacon and manual clearing of variables in AEP Web SDK? Attached image is my current implementation in AA. Thank you.

 

avocadoLover2022_0-1720599466223.png

 

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

12 Replies

Avatar

Level 2

Hello,

With the AEP Web SDK, it is a whole new way of tracking !
i recommend to use the extension Adobe Experience Platform Web SDK and the "Send event" action (see my screenshot)
For clearVars(), i am currently working on my migration and i think, it is no longer needed but it depend on your website and technology.

Best regards

Avatar

Level 2

Hi @cserrurier 

 

But I have another custom code in the Set Variables that is also in the same rule that uses Data Element. So in one Action, I have two ways of setting. First is, by manually sending beacon. Second is, using a data element. Would you recommend that I separate this two? Should I make another rule for my currently manual sending of beacon implementation and use the "Send Event" action?

Avatar

Level 2

Hello,
It is difficult to answer without the code.
Can you share a screenshot of your Custom code Action ?

Best regards

Avatar

Level 2

avocadoLover2022_0-1720601447893.png

here is my code. the "pre-sorted" functions as a different event(since it is coming from other page), it has a separate beacon event2. while for the "user sorted" i have append that in my link click event, so when it is "user sorted" event2, event10 will trigger.

Avatar

Level 2

Hello,

Thanks for sharing.

I always recommend to separate action in different rules so i think, you can set 2 rules, condition on your dataElement %preSortingTrackin% and using the extension actions as possible.

Best regards

Avatar

Community Advisor

Hi @avocadoLover2022 

The concept of clear vars and set vars is used for evars and props when you implement adobe analytics however if you are sending data to AEP using web sdk evars and props are no longer required you have to create a schema instead.

check out this adobe analytics data collection migration to web sdk tutorial for more details

Avatar

Level 3

Kindly check these below tutorials it will help you:

https://medium.com/station10/approaches-to-implementing-adobe-analytics-via-aep-web-sdk-and-adobe-la...

https://experienceleague.adobe.com/en/docs/platform-learn/implement-web-sdk/applications-setup/setup...

Also for sending event we can use custom code, like mentioned in below documentation

https://experienceleague.adobe.com/en/docs/experience-platform/web-sdk/commands/sendevent/xdm

So, suppose some time it become difficult to use extension, then we can use custom code and send the alloy event on the basis of the type.

 

Avatar

Community Advisor

Hi @avocadoLover2022 

for what it's worth, the probably quickest way to migrate your code would be using (this is what I typically do for all new clients)

  • a "Web SDK Variable" data element that is set as "Data" with Adobe Analytics enabled
    bjoern__koth_0-1720615801446.png
  • in your rule that is supposed to track the page view, use an Update Variable action and set all props/eVars/events as you would've done it in AppMeasurement
    • the "clear existing value" checkbox will essentially reset the whole variable, so you will to provide the whole mapping here as well
      NOTE: if you are using the same payload across different rules, consider setting the core data in a separate rule that fires before the Analytics page view / link tracking rules, and only set the additional data that is specific to the e.g., page view rule. In that case, make sure to reset the data element in the new rule and not in the page view / link track rule
      bjoern__koth_1-1720616052250.png
    • also worth mentioning that there is also a custom code part on the action in which you can essentially reuse existing code that was referring to the "s" object from AppMeasurement.

 

content.__adobe = content.__adobe || { };
content.__adobe.analytics = content.__adobe.analytics || { };
let s = content.__adobe.analytics;
s.eVar99 = "hello world";

// no need for linkTrackEvents and linkTrackVars anymore!!!
s.events = "event10,event25";​

 

  • use a WebSDK sendEvent action
    • select "use guided events" in combination with "Collect analytics"
    • choose the Analytics event you want to send (Page View or Link Click)
      bjoern__koth_2-1720616474649.png

       

This approach will essentially fill the data.__adobe.analytics part of the request's payload.

bjoern__koth_3-1720616586451.png

 

Hope that helps

Cheers from Switzerland!

Avatar

Level 2

hi @bjoern__koth thanks for your input. But upon checking on my end, I think we don't have that "Data" setting. and we only have "XDM" in rules

avocadoLover2022_0-1720670117510.png

 

Avatar

Community Advisor

Hi @avocadoLover2022 

It seems like you're using an old version of web SDK extension this feature is available as part of the recent new release in web SDK extension try updating your extension to get this.

Avatar

Level 2

Hi @Ankit_Chaudhary yes, i think that's why I am not getting that feature. Our Web SDK extension has an upgrade available. I will surely try this implementation once our team have upgraded the extension. Thank you so much.

 

Also, thanks @bjoern__koth appreciate your insights.

Avatar

Community Advisor

Hi @avocadoLover2022 

yes, it was just introduced with the last version. Make sure to update the extension

 

Cheers

Cheers from Switzerland!