Title: Remembering Visitor Parameters With Javascript Cookie
Last modified: November 3, 2021

---

# Remembering Visitor Parameters With Javascript Cookie

 *  Resolved [honeyvapor](https://wordpress.org/support/users/honeyvapor/)
 * (@honeyvapor)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/remembering-visitor-parameters-with-javascript-cookie/)
 * Hi there,
 * I am trying to show or hide ads based on my visitor’s UTM parameters, but my 
   articles are paginated and the UTM doesn’t follow to page 2, 3, etc.
 * I followed the instructions to use a cookie here: [https://adinserter.pro/faq/how-to-remember-visitors-parameters](https://adinserter.pro/faq/how-to-remember-visitors-parameters)
 * It doesn’t seem to work when I go direct to a link with UTM parameters like:
   
   [https://s39480.p612.sites.pressdns.com/hilarious-google-street-view-images-ever-captured/?utm_source=1&utm_campaign=test](https://s39480.p612.sites.pressdns.com/hilarious-google-street-view-images-ever-captured/?utm_source=1&utm_campaign=test)
 * However, it DOES work if I follow this path:
    homepage > article > add utm_source
   =1 to the end of the url and hit enter
 * I currently have the cookie code set under block one, and the test implementation
   on block 3. I have “whitelisted” the utm_source=1, and “whitelisted” the cookie“
   ai-show-ads”.
 * Are you able to check what is preventing the ad from showing when a visitor goes
   directly to the UTM link?
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fremembering-visitor-parameters-with-javascript-cookie%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  Plugin Author [Spacetime](https://wordpress.org/support/users/spacetime/)
 * (@spacetime)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/remembering-visitor-parameters-with-javascript-cookie/#post-15031240)
 * Block 1 to create a cookie seems to be ok.
 * However, block 3 is not configured to check for url parameter.
    You need to whitelist
   cookie and url parameter:
 * `ai-show-ads, utm_source`
 *  Thread Starter [honeyvapor](https://wordpress.org/support/users/honeyvapor/)
 * (@honeyvapor)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/remembering-visitor-parameters-with-javascript-cookie/#post-15031316)
 * Hi, I just whitelisted url parameter as well and it is still not showing the 
   ads.
 *  Plugin Author [Spacetime](https://wordpress.org/support/users/spacetime/)
 * (@spacetime)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/remembering-visitor-parameters-with-javascript-cookie/#post-15031326)
 * I see block 3 normally inserted on all posts.
 *  Thread Starter [honeyvapor](https://wordpress.org/support/users/honeyvapor/)
 * (@honeyvapor)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/remembering-visitor-parameters-with-javascript-cookie/#post-15031332)
 * Unfortunately it only cookies the user on their second session and I’m not sure
   why.
 * If you try going to the site in incognito mode and following the link above, 
   and clicking through the pages of the article, block 3 never appears.
 *  Thread Starter [honeyvapor](https://wordpress.org/support/users/honeyvapor/)
 * (@honeyvapor)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/remembering-visitor-parameters-with-javascript-cookie/#post-15031346)
 * Oh, I see what you are saying. Why is block 3 being inserted on all of the posts
   now since whitelisting utm_source=1? It is only supposed to whitelist the source,
   and the cookie…
 *  Plugin Author [Spacetime](https://wordpress.org/support/users/spacetime/)
 * (@spacetime)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/remembering-visitor-parameters-with-javascript-cookie/#post-15031368)
 * Sure.
    Block 3 is normally not inserted.
 * But when I visit a post with the utm parametr the cookie is created and block
   3 inserted as the parameter is whitelisted.
    When I visit any other post block
   3 is inserted because the cookie is present.
 *  Thread Starter [honeyvapor](https://wordpress.org/support/users/honeyvapor/)
 * (@honeyvapor)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/remembering-visitor-parameters-with-javascript-cookie/#post-15031379)
 * I am seeing Block 3 inserted on all posts regardless of utm currently.
 * If I open this link in a new incognito window, the ads appear automatically but
   there are no whitelisted utm parameters:
    [https://s39480.p612.sites.pressdns.com/musicians-who-banned-politicians-from-using-their-songs/](https://s39480.p612.sites.pressdns.com/musicians-who-banned-politicians-from-using-their-songs/)
 *  Plugin Author [Spacetime](https://wordpress.org/support/users/spacetime/)
 * (@spacetime)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/remembering-visitor-parameters-with-javascript-cookie/#post-15031424)
 * I can’t reproduce the issue.
    Block 3 is not inserted until I visit the page 
   with the utm parameter.
 * But you also need to set Dynamic blocks to Client-side insert as the pages might
   be cached:
    [https://adinserter.pro/documentation/plugin-settings#dynamic-blocks](https://adinserter.pro/documentation/plugin-settings#dynamic-blocks)
 * Then flush all the caches.
 * You can use debugging function **Label blocks** to diagnose insertions:
    [https://adinserter.pro/documentation/debugging](https://adinserter.pro/documentation/debugging)
 *  Thread Starter [honeyvapor](https://wordpress.org/support/users/honeyvapor/)
 * (@honeyvapor)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/remembering-visitor-parameters-with-javascript-cookie/#post-15031447)
 * Can you check this process to reproduce issue:
    If you remove the cookie from
   your browser and use a new incognito window and visit this link directly: [https://s39480.p612.sites.pressdns.com/musicians-who-banned-politicians-from-using-their-songs/?utm_source=1](https://s39480.p612.sites.pressdns.com/musicians-who-banned-politicians-from-using-their-songs/?utm_source=1)
 * Block 3 does not show at all in the slideshow?
 * However, if you visit the site again without removing cookie, block 3 is now 
   inserted.
 * I am only getting the cookie inserted when the visitor comes to the site a second
   time.
 *  Plugin Author [Spacetime](https://wordpress.org/support/users/spacetime/)
 * (@spacetime)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/remembering-visitor-parameters-with-javascript-cookie/#post-15031461)
 * When you open a new incognito tab there should be no cookies.
 * When I visit the link I get block 3 inserted as it contains the url parameter:
 * ![](https://i0.wp.com/i.ibb.co/7kRKnQn/block-3.png?ssl=1)
 * The cookie is also created but it is deleted when you close the incognito tab.
 * It seems Dynamic blocks are still set to Server-side?
 *  Thread Starter [honeyvapor](https://wordpress.org/support/users/honeyvapor/)
 * (@honeyvapor)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/remembering-visitor-parameters-with-javascript-cookie/#post-15031502)
 * The screenshot you sent me says that is page 1 of 10. Your documentation article
   says that the cookie is not created on the first visit? Could it be that your
   browser is still cookied somehow?
 * I just tested client-side dynamic blocks while clearing cache and none of the
   ads appear at all and I’m not sure why.
 *  Plugin Author [Spacetime](https://wordpress.org/support/users/spacetime/)
 * (@spacetime)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/remembering-visitor-parameters-with-javascript-cookie/#post-15031556)
 * There is no cookie until it is created.
    Therefore you need to whitelist also
   url parameter for the first visit.
 * It seems you have javascript errors on the page.
    Client-side insertions needs
   error-free pages.
 * Try to fix all the errors and then check again.

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

The topic ‘Remembering Visitor Parameters With Javascript Cookie’ is closed to new
replies.

 * ![](https://ps.w.org/ad-inserter/assets/icon-256x256.jpg?rev=1502039)
 * [Ad Inserter - Ad Manager & AdSense Ads](https://wordpress.org/plugins/ad-inserter/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ad-inserter/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ad-inserter/)
 * [Active Topics](https://wordpress.org/support/plugin/ad-inserter/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ad-inserter/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ad-inserter/reviews/)

 * 12 replies
 * 2 participants
 * Last reply from: [Spacetime](https://wordpress.org/support/users/spacetime/)
 * Last activity: [4 years, 7 months ago](https://wordpress.org/support/topic/remembering-visitor-parameters-with-javascript-cookie/#post-15031556)
 * Status: resolved