Can you give some examples with URLs of those dynamic pages?
Thread Starter
Julie
(@habannah)
Sure 🙂 For example, the Subscriptions Management page generated for each user is http://niackery.com/subscriptions/manage/?wysija-page=1&controller=confirm&wysija-key=##########&action=subscriptions&page=manage.
NB: I changed part of the URL to remove identifying information (wysija-key=##########), so the above doesn’t actually work.
Let me know if there’s any other info you need. Thanks!
You can use a filter in your Google Analytics account and exclude all traffic to subdirectories starting with /subscriptions/manage, for example. You can customize it further if for example you do want to track http://niackery.com/subscriptions/manage/ but not http://niackery.com/subscriptions/manage/?wysija-page= using a custom filter.
Thread Starter
Julie
(@habannah)
Good to hear! Thanks as always for your fantastic help 🙂
Thread Starter
Julie
(@habannah)
Hi Alin,
I just wanted to let you know that I found a better solution, in case anyone else ever asks about this…
After implementing the Google Analytics filters, I realized that the data would still be sent to Google, but it would just be filtered out of the data I can see. But because these are pages that potentially contain personally identifiable user information, the point is to prevent Google from getting any data at all.
I was inspired by this post to do the following, which I tested and can confirm that it does prevent the tracking code from loading on the dynamically-generated pages:
/* Move the Google Analytics Dashboard for WP Tracking Code to Footer & Exclude from MailPoet Subscription Pages */
add_action('init', 'n_gadwp_move_trackingcode');
function n_gadwp_move_trackingcode(){
if (class_exists('GADWP_Manager')){
$gadwp = GADWP();
if (isset($gadwp->tracking)){
remove_action('wp_head', array($gadwp->tracking,'tracking_code'), 99);
$uri = $_SERVER["REQUEST_URI"];
$uri_array = split("/",$uri);
$uri_first = $uri_array[1];
$uri_second = $uri_array[2];
if ( ( $uri_second == 'manage' ) || ( $uri_second == 'confirmation' ) || ( $uri_second == 'unsubscribe' ) || ( ( $uri_first == 'subscriptions' ) && ( $uri_second == 'comments' ) ) ) {
echo ' ';
} else {
add_action('wp_footer', array($gadwp->tracking,'tracking_code'), 0);
}
}
}
}
Cool, thanks for the feedback. I’m sure users will find it useful!