Quantcast
Channel: Help with inline IIF ampscript statement - Salesforce Stack Exchange
Viewing all articles
Browse latest Browse all 2

Help with inline IIF ampscript statement

$
0
0

I am trying to write an inline IFF statement for use in our Web Analytics Connector parameter string. Currently I have the following:

...&utm_content=%%=iif(IndexOf("%%linkname%%","http")>0,"unknownlink", "%%linkname%%")=%%

When an explicit Link Name has not been set for a link, the full http.... web address renders in the url as the utm_content value. This breaks our website. So the point of the IFF is to check if %%linkname%% is actually a http web address, then just put "unknownlink" instead.

I have done a lot of testing on this and it seems to work well.

However, now I am trying to also handle links that are an ampscript function. For example, if using a RedirectTo function, then the utm_content paramter value renders in the url as literally %%=RedirectTo(......)=%% which is no good.

So I want to add in an OR to handle both "http" and "%%=" values. But I can't figure out how to do an inline IFF OR statement. I have tried the following:

 ...&utm_content=%%=iif((IndexOf("%%linkname%%","http")>0 OR IndexOf("%%linkname%%,"%%=")>0),"unknownlink", "%%linkname%%")=%%

and

...&utm_content=%%=iif(or(IndexOf("%%linkname%%","http")>0,IndexOf("%%linkname%%,"%%=")>0),"unknownlink", "%%linkname%%")=%%

Neither work. Anyone know how to do this or if it's possible?


Adding some additional info for context

What we are trying to do is be able to track performance of dynamic content in GA. So we are using utm_content as a url analytics parameter and then trying to populate this with the Tracking Alias (%%linkname%%) for GA to use.

However, we would only input a tracking alias value when required (eg: on dynamic content) and leave all other links blank. In this scenario, all other links would result in the entire url of said link being rendered in the resulting url as a parameter value. This breaks out website.

So I am trying to solve for a way to prevent this. Over many long discussions with Salesforce, there didn't seem any known way to do this. Their only suggestion was to put ampscript (like what I am trying to do) in the WAC string to check if a fully formed url was being set as %%linkname%% and overriding this with a simple text string. I did not want to do this initially since in the event any issues arose only support could change the WAC string. Now that admins can edit the WAC string, I am open to putting ampscript in there.


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images