Home / RSS Feeds / CWP – ConvertKit RSS email ID
Duplicate Snippet

Embed Snippet on Your Site

CWP – ConvertKit RSS email ID

Adds ConvertKit email ID to RSS feeds for better conversion tracking

Code Preview
php
<?php
/**
 * RSS feed, add ConvertKit email query string (Part 1)
 */
function cwp_rss_convertkit_email( $url ) {
	return add_query_arg( 'adt_ei', 'subscriber.email_address', $url );
}
add_filter( 'the_permalink_rss', 'cwp_rss_convertkit_email' );
/**
 * Modify ConvertKit email string (Part 2)
 * esc_url will remove "{" and "}" so this adds them back on this specfiic URL
 */
function cwp_rss_convertkit_email_expand( $url ) {
	return str_replace( 'subscriber.email_address', '{{ subscriber.email_address }}', $url );
}
add_filter( 'clean_url', 'cwp_rss_convertkit_email_expand' );

Comments

Add a Comment