Expand my Community achievements bar.

SOLVED

App tracking: Currencycode variable

Avatar

Level 2

According to Adobe's docs, you set the currency code via the following steps: 

  1. Set the currency code in a context data variable during either trackState or trackAction.
  2. Create a processing rule in the Adobe Analytics admin console for the report suite. Set the rule to overwrite the Currency Code variable.
  3. Pass the currency code to the products variable in your call to trackState or trackAction.

 

SEE CODE IN COMMENTS

 

However, when I look in Adobe Analytics, it doesn't report the currency correctly (A t-shirt in 500 DKK is reported as 500 EUR instead of 67 EUR). I'm guessing we're not passing the currency code correctly, but not sure how exactly to correct it? 

1 Accepted Solution

Avatar

Correct answer by
Level 4

ryanpraski_0-1665146822091.png

I was able to successfully set Currency Code in processing rules based on a contextData variable and have it successfully convert the s.products revenue from the currency code passed into the base currency of the report suite when the purchase event was triggered. Also FYI if you are doing this in a website you can use the Adobe Experience Platform Debugger extension to view post-processed Analytics hit data. For mobile app or web sdk (alloy) implementations you can use the Assurance (fka Project Griffon) Adobe tool to see the post-processed hit data. You'll be able to see your currencyCode set in processing rules and your s.products revenue will be converted in the post-processed hit.

 

Hopefully this helps you Jacob and other who may run into this in the future.

 

-ryanpraski

View solution in original post

15 Replies

Avatar

Level 7

decO@jacobs84905156 I am not sure which CODE you are referring here. Processing rules in Analytics are used to overwrite value or delete value or setting an event as per the defined rules. From the description I am assuming that you are trying to convert the sent 500 DKK to 67 EUR by using processing rule. If this is the case then can you please share the screenshot of the processing rule where you have set this rule ?

Avatar

Level 2
Hi @amgup, thanks for your prompt reply! I'm having trouble sharing my code - hope you can see this gist: https://gist.github.com/jacobsander/b0c5c0168046179e6a34a3a1f1ba8c7b

Avatar

Level 2
I'm pretty sure we're not executing step 1 or 3 from the guidelines correctly, but unsure what the code should look like to work

Avatar

Employee

@jacobs84905156 .

Could you please try below mentioned syntax:

HashMap<String, Object> cdata = new HashMap<String, Object>();
                    cdata.put("testcontext", "Context Data trackAction button");
                    cdata.put("&&currencyCode", "DKK");
                    //cdata.put("&&cc", "Context Data trackAction button");
                    //Send Adobe Analytics trackAction with contextData
                    Analytics.trackAction("TrackAction", cdata);

Or

cdata.put("&&cc", "DKK");

Here we are applying && to make sure that currencyCode is fired as query string parameter in the Adobe server call and conversion happens.

The currency code requires the double ampersands because it appears as though the currency conversion occurs prior to context data processing. Setting the currency code as context data might not work for currency conversion.

Avatar

Level 2
@vibhatna Thanks so much for your reply! I'll give it a try and let you know

Avatar

Level 2
@vibhatna Quick question: We're using Swift so the syntax looks a bit different. Can you by any chance verify is this is the same as what you propose? https://gist.github.com/jacobsander/9ae6c419a63fd44eea7ae5b694a3d533

Avatar

Employee
@jacobs84905156, Did this solution work? Are you able to see the currency conversion in reports?

Avatar

Level 2
@vibhatna sorry for the lack of update. We still have some issues - the changes you suggest ed did help us see revenue etc. in the real-time report, but for some reason we can't see it in Workspace! We're currently in touch with Adobe, who are looking into the issue. I'll keep you posted once we've found a solution! Thanks so much again for taking the time to help

Avatar

Employee

Sure @jacobs84905156 

You can try this as per https://gist.github.com/jacobsander/9ae6c419a63fd44eea7ae5b694a3d533

Once implemented please check if Currency code is being fired outside "c." and ".c" or inside? It should be fired outside these parameters. 

 

Avatar

Level 10
Do any of the answers below answer your initial question? If so, can you select one of them as the correct answer? If none of the answers already provided answer your question, can you provide additional information to better help the community solve your question?

Avatar

Level 2
@jantzen_b unfortunately the issue has not yet been resolved, while I do appreciate the efforts made on this thread. At the time of writing we are in contact with Adobe's engineer team. I figure I could post the solution before I mark this has resolved.

Avatar

Level 10
Thanks for following up. Yes, please do post the solution you receive from our engineering team. This will help others that might also have this question. Thanks!

Avatar

Level 10
Any updates from the engineering team?

Avatar

Correct answer by
Level 4

ryanpraski_0-1665146822091.png

I was able to successfully set Currency Code in processing rules based on a contextData variable and have it successfully convert the s.products revenue from the currency code passed into the base currency of the report suite when the purchase event was triggered. Also FYI if you are doing this in a website you can use the Adobe Experience Platform Debugger extension to view post-processed Analytics hit data. For mobile app or web sdk (alloy) implementations you can use the Assurance (fka Project Griffon) Adobe tool to see the post-processed hit data. You'll be able to see your currencyCode set in processing rules and your s.products revenue will be converted in the post-processed hit.

 

Hopefully this helps you Jacob and other who may run into this in the future.

 

-ryanpraski