Strange behavior when injecting A/B-testing scripts


I am experiencing something strange when using Episerver.Marketing.Testing (A/B testing):

When the A/B-testings scripts are injected into the result, most of the page is repeated. The meta-data, scripts, CSS and markup is presented twice to the user. I've been trying to debug and my theory is that something happens in ClientKpiInjector where the scripts are built or in ABResponseFilter where the output of ClientKpiInjector is merged with into the HTML stream. After the final A/B script, some strange characters are added: "  " followed by the entire contents of _Layout.cshtml (including the page contents itself).

Have anyon seen this behavior before of have any ideas on what could be the reason?

Running version 2.6.10 of Episerver.Marketing.Test.


Bjørn Terje Svennes

Mar 25, 2022 12:58

After recreating the code from Episerver.Marketing.Test I'm sure the error has something to do with the injection using ABResponseFilter. My own implementation uses IRequiredClientResourceList instead from a ActionFilterAttribute. This works well. I don't understand why this is not used by the original code.

Still open to other suggestions.

Mar 25, 2022 14:54

I've found the problem. In my solution there are multiple parts of the code that sets Response.Filter. The combination of these doesn't seem to be a good mix.

Mar 28, 2022 9:24
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.