Formulas / Expressions for Web Analytics (Brand Configuration)

Avatar

Avatar
Validate 10
Level 3
davidh2892249
Level 3

Likes

17 likes

Total Posts

132 posts

Correct reply

2 solutions
Top badges earned
Validate 10
Validate 1
Ignite 5
Ignite 3
Ignite 1
View profile

Avatar
Validate 10
Level 3
davidh2892249
Level 3

Likes

17 likes

Total Posts

132 posts

Correct reply

2 solutions
Top badges earned
Validate 10
Validate 1
Ignite 5
Ignite 3
Ignite 1
View profile
davidh2892249
Level 3

07-09-2020

Hi All,

 

I would like to be able to output the "event date" in YYYY/MM format for my google analytics links, which are set up in a brand configuration.

 

I've configured like below, using expression ToString(Year(context.eventDate)+'/'+Month(context.eventDate))

davidh2892249_0-1599475581512.png

 

 

However, this returns the following error in the sending logs (with a status failed) when attempting to send a delivery.

Error while compiling script 'DM282[htmldefaultContent]' line 49: Year is not defined.

 

Seems I cannot use the date functions? (this type of expression worked fine on workflow worktable expressions)

 

Has anyone got any ideas as to how I can achieve event date in YYYY/MM for GA tracking?

 

Thanks

 

David

 

Accepted Solutions (0)

Answers (3)

Answers (3)

Avatar

Avatar
Boost 5
Employee
denisb91363072
Employee

Likes

8 likes

Total Posts

34 posts

Correct reply

7 solutions
Top badges earned
Boost 5
Affirm 5
Boost 3
Boost 1
Affirm 3
View profile

Avatar
Boost 5
Employee
denisb91363072
Employee

Likes

8 likes

Total Posts

34 posts

Correct reply

7 solutions
Top badges earned
Boost 5
Affirm 5
Boost 3
Boost 1
Affirm 3
View profile
denisb91363072
Employee

04-11-2020

Could you try syntax such as below? 

 

context.delivery.messageType.substring(0,2).toLowerCase()+':'+ context.delivery.executionType +':'+context.delivery.campaign.label+context.eventDate.getFullYear().toString().substring(2)+'-'+context.profile.location.countryCode.toLowerCase()+':'+context.cusExternalId + '::'

 

It should work....

Avatar

Avatar
Give Back 50
Employee
Sukrity_Wadhwa
Employee

Likes

176 likes

Total Posts

934 posts

Correct reply

35 solutions
Top badges earned
Give Back 50
Validate 1000
Validate 500
Validate 250
Validate 100
View profile

Avatar
Give Back 50
Employee
Sukrity_Wadhwa
Employee

Likes

176 likes

Total Posts

934 posts

Correct reply

35 solutions
Top badges earned
Give Back 50
Validate 1000
Validate 500
Validate 250
Validate 100
View profile
Sukrity_Wadhwa
Employee

16-09-2020

Hi @davidh2892249,

Was the given solution helpful or were you able to resolve this query with some other solution? Do let us know.

Thanks!

Avatar

Avatar
Validate 1
Level 1
supratim1034
Level 1

Likes

0 likes

Total Posts

8 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
supratim1034
Level 1

Likes

0 likes

Total Posts

8 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile
supratim1034
Level 1

09-09-2020

Although I have not tried, however, I have seen JS methods (and not inherent ACS method) working in that brand screen. So instead of Year() or Month() which are native to ACS, can you try something like getFullYear() and getMonth().

Please let me know if this actually works!