0

We are already using AMP to create dynamic URL. We are also doing A/B tests and I want to add the variant of a contentblock into the dynamic URL. Below you see the current AMP we're using to create the URLs. I add @CID_code to every URL.

The new variant needs to have a code to add to the URL like this: CID=EML_NB_BL_A_20210111 or CID=EML_NB_BL_B_20210111.

I wanted to add TestA or TestB to the name of the contentblock and catch that with AMP, but that's not possible if I look into the development guides. Any ideas how to fix this?

%%[
/* UTM code genereren */
SET @hp                = AttributeValue("hp")
SET @date_today        = Format(Now(), "yyyyMMdd")

IF @hp == "bl"         THEN
    SET @CID_code = Concat("CID=EML_NB_BL_", @date_today)

ELSEIF @hp == "kk"           THEN
    SET @CID_code = Concat("CID=EML_NB_L_KK_", @date_today)

ELSEIF @hp == "gr"          THEN
    SET @CID_code = Concat("CID=EML_NB_L_GR_", @date_today)

ELSEIF @hp == "vv"  THEN
    SET @CID_code = Concat("CID=EML_NB_L_VV_", @date_today)

ELSEIF Empty(@hp)                     THEN
    SET @CID_code = Concat("CID=EML_NB_NL_", @date_today)

ENDIF
]%%
2
  • how are you doing your A/B Testing? The email studio tool? Journey Builder? Custom SQL? Jan 11, 2021 at 16:06
  • We're using the A/B test building block in Email Studio. So parts of the email need the regular @CID_code, and only two blocks need to have _A or _B added.
    – Anne
    Jan 12, 2021 at 15:50

2 Answers 2

0

If you are trying to define the testA / testB part in the name of the content block, It sounds to me like you could also just do it at the beginning of the block content. I think you just need to introduce a variable, let's call it "@variant", and put a slightly different ampscript definition into your two content blocks:

AMPScript for Variant A:


%%[
SET @variant = "_testA"
]%%

AMPScript for Variant B

%%[
SET @variant = "_testB"
]%%

and then you use this in your parameter definition (it's the same in both A and B, but has to be below the above code snippet so it understands "@variant"):

%%[
/* UTM code genereren*/

SET @hp                = AttributeValue("hp")
SET @date_today        = Format(Now(), "yyyyMMdd")

IF @hp == "bl"         THEN
    SET @CID_code = Concat("CID=EML_NB_BL_", @date_today,@variant)

ELSEIF @hp == "kk"           THEN
    SET @CID_code = Concat("CID=EML_NB_L_KK_", @date_today,@variant)

ELSEIF @hp == "gr"          THEN
    SET @CID_code = Concat("CID=EML_NB_L_GR_", @date_today,@variant)

ELSEIF @hp == "vv"  THEN
    SET @CID_code = Concat("CID=EML_NB_L_VV_", @date_today,@variant)

ELSEIF Empty(@hp)                     THEN
    SET @CID_code = Concat("CID=EML_NB_NL_", @date_today,@variant)

ENDIF
]%%

does this help?

2
  • But in this case I don't check if the contentblock is the A variant or the B variant right? So parts of the email need the regular @CID_code, and only two blocks need to have _A or _B added. And when the email is send the system needs to check which variant is send.
    – Anne
    Jan 12, 2021 at 15:51
  • If your email contains one block relevant for A/B testing, thething that's important is that only this respective block contains the set statement which says SET @variant = "_testB". from a business usecase I would assume that the variant is relevant for the entire email, as presence of some content will affect the performance of the rest of the mail. But if you disagree, then you cannot use parameter manager to attach links, but really build each link separately. And you would have to empty the variable after your block with set @variant = "" and then repeat the CID code definition block. Jan 12, 2021 at 16:23
0

I have not tested this yet, but as the AB Testing block in Content Builder uses Impression Regions on each block, you might try using the personalization string %%_ImpressionRegionName%% inside your UTM attribute to differentiate which block it is coming from.

For example, something like:

%%[
/* UTM code genereren */
SET @hp                = AttributeValue("hp")
SET @date_today        = Format(Now(), "yyyyMMdd")
SET @ir                = _ImpressionRegionName

IF @hp == "bl"         THEN
    SET @CID_code = Concat("CID=EML_NB_BL_", @date_today,"_",@ir)

ELSEIF @hp == "kk"           THEN
    SET @CID_code = Concat("CID=EML_NB_L_KK_", @date_today,"_",@ir)

ELSEIF @hp == "gr"          THEN
    SET @CID_code = Concat("CID=EML_NB_L_GR_", @date_today,"_",@ir)

ELSEIF @hp == "vv"  THEN
    SET @CID_code = Concat("CID=EML_NB_L_VV_", @date_today,"_",@ir)

ELSEIF Empty(@hp)                     THEN
    SET @CID_code = Concat("CID=EML_NB_NL_", @date_today,"_",@ir)

ENDIF
]%%

I added the impressionRegion name to the end, but you can move that wherever you want. If that name is too long, there is an %%_ImpressionRegionID%% as an option or you can assign your own flag using a conditional statement in AMPScript before inserting on the string.

E.g.

SET @ir = _ImpressionRegionName

IF @ir == "myAContentBlockName" THEN
  SET @block = "A"
IF @ir == "myBContentBlockName" THEN
  SET @block = "B"
ELSE
  SET @block = "NA"
ENDIF

/* Then use the following to concat it in
  SET @CID_code = Concat("CID=EML_NB_NL_", @date_today,"_",@block)
*/

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .