• Resolved nikolay100

    (@nikolay100)


    Hi,
    I am trying to add Ads before a HTML element on this page – https://price-comparison.info/
    I have enabled the enabled output buffering and added a block to this div:
    div#drts-body > div > div:eq(2) > div > div > div:eq(1)
    It is between the products list.
    But the ads are not appearing.
    Thank in advance for the help.

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

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

    (@spacetime)

    I don’t see any div with id drts-body on the page.

    And your selector is way too complex.
    A sligthest change in the page layout would invalidate your selector – this may already happened.

    Try to use the shortest and universal selector that describes the insertion position, for example div.drts-view-entity-container

    However, I see no easy way to insert there as the layout is pretty complex.
    You would also have to use the same classes as existing elements (i.e. replicating existing elements), otherwise the page layout will be destroyed.

    Thread Starter nikolay100

    (@nikolay100)

    Thank you for the answer and suggestions.

    BTW the selector I mentioned previously was given by your selector suggesting tool in the plugin.

    I managed to insert the ads between the items in the grid using CSS selectors. For example with this one:
    div.drts-col-12.drts-col-sm-6.drts-view-entity-container
    It does work very well. The only issue is that it inserts the ads before the first item in the grid.
    I would like to insert them in random places in the grid – but since I am not sure if this is possible to achieve with CSS only, I wanted to insert them for example before 8 and 14 items.
    So I tried the following selector:
    div.drts-gutter-sm > div:nth-of-type(8) – it did not work for some reason
    I also tried Xpath:
    //div[@class='drts-row drts-gutter-sm drts-y-gutter']/div[8] – again it did not work.

    Any suggestions will be appreciated.

    Plugin Author Spacetime

    (@spacetime)

    Yes, the tool shows the path to the selected element.
    The path (selector) works for the page where the tool is used.
    However, it is up to you to use the right selector from this path.

    I see no way for random insertions in your case.

    For fixed insertion positions you can use serverside insertion – please note that pseudo selectors do not work with server-side insertion:
    https://adinserter.pro/documentation/insertion-before-inside-after-html-element

    and then use Filter to define insertion positions:
    https://adinserter.pro/documentation/additional-block-settings#filter

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Insertion Before, Inside or After a HTML element not working’ is closed to new replies.