WordPress.org

Ready to get started?Download WordPress

Forums

WP Super Cache
Google AdWords gclid parameter conflicting with caching (10 posts)

  1. DaveBurns
    Member
    Posted 1 year ago #

    I'm seeing the same issue as this guy:

    http://wordpress.org/support/topic/google-adwords-ignore-gclid-get-parameter?replies=1

    Basically, Google AdWords' adds a URL parameter (gclid=SomeSortOfGUID) and WPSC thinks it needs to regenerate the page. It's not clear to me how to tell WPSC to ignore this URL parameter. Is there a way? Right now, everyone who comes to me through an ad click gets a (slowly) regenerated page which isn't great.

    Thanks.

    http://wordpress.org/extend/plugins/wp-super-cache/

  2. Donncha O Caoimh
    Member
    Plugin Author

    Posted 1 year ago #

    Why not add a .htaccess rule that redirects gclid=* to the url without that parameter?

  3. DaveBurns
    Member
    Posted 1 year ago #

    That misses the point so sorry if I was unclear.

    If I remove that param, then the Google JS code that looks for it to do better ad tracking has nothing to work with. The ideal would be to leave it there for Google to use but have the plugin ignore it. Some sort of solution where I could supply a list of URL params that are known to NOT affect the cached result seems like a good way to go. Thoughts?

  4. Donncha O Caoimh
    Member
    Plugin Author

    Posted 1 year ago #

    Ah, I didn't know that. An ignore list would be useful. I can't promise it'll be added quickly however.

  5. DaveBurns
    Member
    Posted 1 year ago #

    Ok. I may took a look at the code myself if I can find the time. In the meanwhile, how should things behave in my situation if I have the "Don't cache pages with GET parameters" option UNchecked on the Advanced tab?

  6. Donncha O Caoimh
    Member
    Plugin Author

    Posted 1 year ago #

    I presume you've tried it already but the plugin will create wp-cache cache files if GET parameters are present. At least in this case all anonymous users who come to the site with the same gclid param will be served the same wp-cache file.

  7. DaveBurns
    Member
    Posted 1 year ago #

    Right. The point is that this "gclid" param is unique per click (gclid = Google Click ID). So no one will share the same gclid with anyone else which breaks caching.

  8. Papoum
    Member
    Posted 1 year ago #

    Hi,

    I have the same problem.
    Have you found a solution to ignore gclid parameter and make Adwords visitors see cached pages ?

    Thanks.

  9. Papoum
    Member
    Posted 1 year ago #

    I found a way to ignore gclid parameter (Adwords automatic tracking) by addind the following lines in the wp-cache-config.php (in the wp-content folder) :

    $param = "gclid";
    unset($_GET[$param]);
    list($urlRoot, $params) = array_pad(explode('?', $_SERVER[ 'REQUEST_URI' ]), 2, '');
    if (!empty($params)) {
    	parse_str($params, $vars);
    	unset($vars[$param]);
    	if (count($vars) > 0) {
    		$newParams = http_build_query($vars);
    		$_SERVER[ 'REQUEST_URI' ] = $urlRoot . '?' . $newParams;
    	}
    	else {
    		$_SERVER[ 'REQUEST_URI' ] = $urlRoot;
    	}
    }

    There are probably better ways to do that but it seems to work.
    Now cached pages are served to Adwords visitors.

    As I want to ignore also parameters used by Google Analytics Experiments, I apply the same method for "utm_expid" and "utm_referrer".

  10. Norbert McDorbert
    Member
    Posted 1 year ago #

    Thank you Papoum for posting this.

    Did you put it anywhere?

    Also - I am new to php, etc, did you just add

    $param = "glclid,utm_expid,utm_referrer";
    or list one per param?

    param = gclid
    param = utm_expid
    param = utm_referrer

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic