• Resolved joexmith

    (@albrivero)


    Hi,

    Here you have the details about the issue. I would appreciate your help.

    PROBLEM:
    An ad block that is inserted multiple times using multiple shortcodes is actually being duplicated in the head section.

    SETUP:
    Ad Inserter version is 2.7.22

    Examples of recent post pages:
    https://destinoreinounido.com/que-hacer-en-londres-en-navidad/
    https://destinoreinounido.com/que-ver-hacer-visitar-en-londres-con-ninos/

    The blog has ads inside posts, sidebars and other locations. They are managed by Google Ad Manager and inserted by AdInserter. The configuration has been working for a long time but recently I have found that the ads inside posts are not showing.

    Every post has a variable number of ads depending on the post’s length that I insert manually with the shortcode for block #5. That means that one post would have 5 ads, another 2 or 7 or whatever.

    THE ISSUE:
    I recently found the site had the error “googletag.defineSlot was called without a matching googletag.display call.” That means that there is a mismatch between the number of times the ads are defined in the header and the times they are inserted in the page.

    The issue appears when inserting one block a multiple number of times (in my case block #5). The block is duplicated in the head section.

    So, if a post has 5 insertions of the shortcode, the block code actually appears 10 times in the head section but only 5 times in the post. That mismatch generates the “googletag.defineSlot was called without a matching googletag.display call” error message.

    Other ads that are inserted only once, like the ones in the sidebar, work fine.

    I’ve seen a similar issue documented here (https://ww.wp.xz.cn/support/topic/add-duplication/) and here (https://ww.wp.xz.cn/support/topic/adinserter-header-being-duplicated/) so I’ve tried changing the Filter parameter but the block is still added twice.

    Any help would be appreciated.

    Many thanks

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Spacetime

    (@spacetime)

    Hello,

    since it has been working for a long time and there were no changes in the plugin in this regard, it seems there is an issue with the settings or code(s) used.

    Need to check your settings – will let you know.

    Plugin Author Spacetime

    (@spacetime)

    It seems the codes are not duplicated – block 5 is “called” 8 times and consequently counter goes from 1 to 8.
    However, only 4 (automatic) insertions are in the body part – 5 to 8.

    The first 4 calls for block 5 are made with shortcode

    [adinserter name="InArticle Display Ad"]

    It seems that the plugin is called 4 times to expand the shortcode, consequently the block counter increases and generates header code.
    However, this code is not used (inserted).

    Where do you use this block via shortcode?

    Thread Starter joexmith

    (@albrivero)

    Yes, you are right, block 5 is called 8 times and the counters work fine. But that’s the thing, it should only be called 4 times, the number of insertions of the shortcode in the post.

    The way it used to work before is the following:
    1.- I call the block manually inside the post editor adding the shortcode [adinserter name=”InArticle Display Ad”] 4 times.
    2.- The header shows 4 ad placement definitions(googletag.defineSlot) with counters going from 1 to 4.
    3.- The body shows 4 ad insertions (googletag.display) with counters (div id) going from 1 to 4.
    4.- Everything works fine.

    Now it works like this:
    1.- I call the block manually inside the post editor adding the shortcode [adinserter name=”InArticle Display Ad”] 4 times.
    2.-The header shows 8 ad placement definitions (googletag.defineSlot) with counters going from 1 to 8.
    3.- The body shows 4 ad insertions (googletag.display) with counters (div id) going from 5 to 8.
    4.- Error message shows:”googletag.defineSlot was called without a matching googletag.display call.”

    The ads are defined 8 times although they are only called 4 times via the shortcode. Also, the ids visible on the page go from 5 to 8 instead of 1 to 4.

    Something somehow is calling the block twice the times it should be, therefore duplicating the ad insertions (and messing with the googletag.display codes)

    • This reply was modified 3 years, 6 months ago by joexmith.
    Plugin Author Spacetime

    (@spacetime)

    The plugin is configured for automatic insertion of block 5 after 4 paragraphs: 5,15, 30, 42.
    This is 4 insertions, however, on that post it seems the block is not iserted this way.
    Anyway, I would suggest to use either automatic or manual insertions.

    The insertion log shows block 5 is called 8 times via the shortcode. This is very likely because of the way how your theme processes the content.
    It is also possible that some other plugin processes post content which may cause the shortcodes in the post to be expanded and consequently the insertion counter increased.

    Do the following for block 5:
    – check Insert only in the loop
    https://adinserter.pro/documentation/additional-block-settings#insert

    – set Filter to 1 (using auto counter)
    https://adinserter.pro/documentation/additional-block-settings#filter

    This should prevent extra invisible insertions (shortcode calls) of block 5.

    Thread Starter joexmith

    (@albrivero)

    Thanks for the suggestions. I tried checking Insert only in the loop and setting Filter to 1 but it didn’t work.

    I found that there’s indeed a plugin processing post content. It’s called Canvas (https://ww.wp.xz.cn/plugins/canvas/) and it’s a block-based page builder that came with the theme.

    When I deactivate the plugin to test, the ad codes are inserted correctly and no error message is shown. But the theme is using that plugin extensively so turning it off is not an option.

    I’ll try to get in touch with the developers (https://codesupply.co/) to get some support or try to find a workaround.

    Thanks for your help.

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

The topic ‘Ad block insertions duplicated in header’ is closed to new replies.