Web analytics services such as Google Analytics track and report website traffic. Salesforce Marketing Cloud includes a Web Analytics Connector which enables you to automatically append email links with web analytics parameters, which can be used to attribute webpage visits back to an email. In this episode, I explain how to configure this feature and share techniques for customizing parameter values.
Hello and welcome back to mcChat. In this episode, we’ll look at the Web Analytics Connector in Salesforce Marketing Cloud.
Web analytics services such as Google Analytics track and report website traffic. Salesforce Marketing Cloud includes a Web Analytics Connector which enables you to automatically append email links with web analytics parameters, which can be used to attribute webpage visits back to an email.
These URL parameters can include personalization strings and AMPscript to programatically build parameter values.
To enable this feature, open Parameter Management in Setup and click the Activate button, then click the Edit button. Here you will see the default URL parameters which you can customize.
The default parameters use system data personalisation strings to include email-level, Subscriber-level and link-level data.
Let's take a look at some different scenarios.
Perhaps you want to customize the
utm_source parameter value based on an attribute from your email, if it's defined.
On my email properties page, I've defined a custom attribute in the Additional Email Attribute 1 field.
The following inline AMPscript function will use this attribute value if it’s been defined, and fallback to 'sfmc' if the field is empty:
%%=iif(not Empty(__AdditionalEmailAttribute1), __AdditionalEmailAttribute1, 'sfmc')=%%
Or perhaps you want to retrieve a value from a Data Extension. The following inline AMPscript function will lookup a value from a Data Extension field based on the email name, and use the resulting value as the
utm_campaign parameter value:
%%=Lookup('Campaigns', 'Campaign Name', 'Email Name', emailname_)=%%
And if you want to include a sophisticated AMPscript expression to return a value, for example, use variables and multiple if/else statements, then you can include your expression in a Content Block and retrieve the resulting value using a Content Block function.
You’ll need to ensure that your content block is a 'code snippet' and not another content type, as all other types are wrapped with an html table tag, which will cause the value to be output incorrectly. Additionally, consider using the ContentBlockById function over another ContentBlock function, as ContentBlockById is more performant.
Web analytics parameters are appended to all links in an email, but you may want to exclude these parameters from certain URLs. For example, when linking to external websites that don’t accept or handle tracking parameters.
The following AMPscript code will prevent these parameters from being appended to an individual link:
%%[ var @url, @link set @url = 'https://mc.chat' set @link = Concat('<a href=', @url, ' alias="mc.chat">Visit page</a>') ]%% %%=v(@link)=%%
Well, thanks for watching and please visit mc.chat for more tips in working with Salesforce Marketing Cloud. See you next time!