Title: W3 Total Cache And Widgets With Javascript
Last modified: August 19, 2016

---

# W3 Total Cache And Widgets With Javascript

 *  [cfisher](https://wordpress.org/support/users/cfisher/)
 * (@cfisher)
 * [15 years, 10 months ago](https://wordpress.org/support/topic/w3-total-cache-and-widgets-with-javascript/)
 * Does W3 Total Cache cache widgets with javascript? I’ve looked everywhere and
   cannot find answer to this. I use Googe Ad Manager which provides javascripts
   that I place in widgets to display ads. I cannot have W3 Total Cache cache these
   else my sold ad impressions wouldn’t be counted correctly.
 * Thanks!!
    Chris

Viewing 10 replies - 1 through 10 (of 10 total)

 *  [Pascal Dreissen](https://wordpress.org/support/users/pdreissen/)
 * (@pdreissen)
 * [15 years, 10 months ago](https://wordpress.org/support/topic/w3-total-cache-and-widgets-with-javascript/#post-1629762)
 * I think Frederick knows the best answer, but my guess would be that you need 
   to use fragmented cache (see the faq in the plugin how to use it). On the other
   hand the javascript portion would make an external request which is not cached
   afaik !
 *  Thread Starter [cfisher](https://wordpress.org/support/users/cfisher/)
 * (@cfisher)
 * [15 years, 10 months ago](https://wordpress.org/support/topic/w3-total-cache-and-widgets-with-javascript/#post-1629775)
 * Thanks for your response. That would great if it doesn’t cache the javascript
   external request. The javascript code does not change and could be cached if 
   it could still make its external call to Google Ad Manager which would then output
   the appropriate ad. I will be curious to see what Frederick has to say.
 * Thanks!
 *  Thread Starter [cfisher](https://wordpress.org/support/users/cfisher/)
 * (@cfisher)
 * [15 years, 10 months ago](https://wordpress.org/support/topic/w3-total-cache-and-widgets-with-javascript/#post-1629905)
 * Frederick – if you are out there and can answer this question, I would greatly
   appreciate it. I want to implement W3 Total Cache but need to make sure it will
   not affect by ad impressions as described above. Thanks!! Chris
 *  [Frederick Townes](https://wordpress.org/support/users/fredericktownes/)
 * (@fredericktownes)
 * [15 years, 10 months ago](https://wordpress.org/support/topic/w3-total-cache-and-widgets-with-javascript/#post-1629906)
 * Do not minify ad (adsense etc), statistics or analytics tracking code. So do 
   not minify your DoubleClick for Publishers (Google Ad Manager) JS code. There
   is simply no benefit to doing this based on how these services currently work
   unless you know exactly what you are doing. Enabling page caching will cache 
   entire page output created by WordPress (widgets ad all), it will not break your
   existing scripts by itself.
 *  Thread Starter [cfisher](https://wordpress.org/support/users/cfisher/)
 * (@cfisher)
 * [15 years, 10 months ago](https://wordpress.org/support/topic/w3-total-cache-and-widgets-with-javascript/#post-1629908)
 * I won’t minify what you referenced. Thanks for that.
 * So sorry, but I am having trouble understanding your last statement because of
   my own ignorance:
 * You said, “Enabling page caching will cache entire page output created by WordPress(
   widgets ad all), it will not break your existing scripts by itself.”
 * Does your statement mean that W3 Total Cache will actually cache the external
   calls (and not just the JS code) and thus affect the number of impressions in
   DoubleClick for Publishers?
 * Thanks so much for your response. I really appreciate it.
 *  [Frederick Townes](https://wordpress.org/support/users/fredericktownes/)
 * (@fredericktownes)
 * [15 years, 10 months ago](https://wordpress.org/support/topic/w3-total-cache-and-widgets-with-javascript/#post-1629910)
 * No, I meant that whatever WordPress returns when you request a page is what the
   page cache contains. Your ad code is powered by JavaScript so it matters not 
   if the page is cached JavaScript is run just the same.
 *  Thread Starter [cfisher](https://wordpress.org/support/users/cfisher/)
 * (@cfisher)
 * [15 years, 10 months ago](https://wordpress.org/support/topic/w3-total-cache-and-widgets-with-javascript/#post-1629911)
 * OK. Thanks. So it sounds like it does cache the actual advertisements. This won’t
   work for me. I sell ads based on number of impressions and if they are cached
   it will significantly reduce the actual impression count.
 * I know there are tons of website using W3 Total Cache with advertisement managers.
   I would greatly appreciate it if anyone out there could help out and explain 
   how you use W3 Total Cache on a site that serves advertisements based on live
   impression counts.
 * Thanks,
    Chris
 *  [Frederick Townes](https://wordpress.org/support/users/fredericktownes/)
 * (@fredericktownes)
 * [15 years, 10 months ago](https://wordpress.org/support/topic/w3-total-cache-and-widgets-with-javascript/#post-1629914)
 * That’s exactly the opposite of what I said. Ads are served by JavaScript, nothing
   is caching those. Page caching doesn’t affect impressions, if it did caching 
   wouldn’t be usable for most of the sites on the web.
 * The fact is you need page caching to get more impressions out of your server 
   without increasing hardware. I don’t know how to be more clear, that basically
   everything you’re worried about is a non-issue because W3TC doesn’t affect those
   things unless you change default settings to create that problem.
 *  Thread Starter [cfisher](https://wordpress.org/support/users/cfisher/)
 * (@cfisher)
 * [15 years, 9 months ago](https://wordpress.org/support/topic/w3-total-cache-and-widgets-with-javascript/#post-1629931)
 * Hehe. Thanks Frederick for your patience and further elaboration. Your last explanation
   was very clear to me now. My apologies for the lack of earlier understanding.
   I plan to implement W3 Total Cache with a CDN very soon now that I know it will
   work! Thanks!!
 * Chris
 *  [Frederick Townes](https://wordpress.org/support/users/fredericktownes/)
 * (@fredericktownes)
 * [15 years, 9 months ago](https://wordpress.org/support/topic/w3-total-cache-and-widgets-with-javascript/#post-1629937)
 * You’re welcome.

Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘W3 Total Cache And Widgets With Javascript’ is closed to new replies.

## Tags

 * [javascript](https://wordpress.org/support/topic-tag/javascript/)
 * [widgets](https://wordpress.org/support/topic-tag/widgets/)

 * 10 replies
 * 3 participants
 * Last reply from: [Frederick Townes](https://wordpress.org/support/users/fredericktownes/)
 * Last activity: [15 years, 9 months ago](https://wordpress.org/support/topic/w3-total-cache-and-widgets-with-javascript/#post-1629937)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
