If you are on WordPress, the SmartFormat WordPress Plugin may help you create a valid SmartFormat feed. Once you install and activate the plugin, the Settings screen (pictured below) will give you a dialog box to paste in your preferred analytics script, ad tag, and configure up to two Sponsored Links.
In order to demonstrate how the plugin works, I've pasted the output of the the Analytics, Ad, and Sponsored Link sections. When you have the plugin running, you can find the SmartFormat feed at:
https://www.yourdomain.com/?feed=smartformat
As you can see below, the plugin adds wrappers for your various elements including the <snf> links as well as the appropriate CDATA wrappers. Because of this, you only need to add the raw scripts from your analytics and advertising platforms.
<snf:advertisement>
<snf:sponsoredLink
title="Try our newsletter!"
link="https://domain.com/newsletter-sign-up.html"
thumbnail="https://www.domain.com/wp-content/uploads/2020/04/fearless-nyc-scaled.jpg"
advertiser="Advertiser Name" />
<snf:adcontent><![CDATA[<! advertising script goes here>]]></snf:adcontent>
</snf:advertisement>
<snf:analytics><![CDATA[<! analytics script goes here>]]></snf:analytics>
Related:
- If you are adding Google Ad Manager tags to your feed, please see this FAQ.
- SmartNews allows up to three analytics scripts. If you would like to add multiple analytics scripts to your feed, please see this FAQ.