(1.Question) Is it possible to ensure that different background images are equally displayed to visitors who switch to the site? Assume that the first user who has switched to the site displays the first picture, the second user has the second picture, and the third one has the third picture. Only 4 pictures. And so cyclically.

(2 Question). Is it possible to somehow adjust the goals in the metric so that it is counted when the user downloads the file, or when the modal window is displayed?

  • (1) You can. $bgs[array_rand($bgs)] . (2) You can. Different links. - user207618
  • So it will display random pictures, but you need to change the pictures in order, first went to the site — the first picture is shown. The second person is the second picture and so on until 4 pictures and then again. - Yaroslav TheRock
  • Tell me, can I track the background image in the Yandex metric? The customer wants to determine at which background image there are more conversions. This can be done? - Yaroslav TheRock

1 answer 1

  1. If cyclically, it is necessary to store data. For example, specify a starting point of "0"; the next one that goes to the page gets the current value +1 on php, for example

    $ current = $ valueFromDb + 1; $ imgSrc = "/path/to/img/folder/".$current.".jpg";

You do the check, if $ valueFromDb == 1, then $ current assigns one. Accordingly, the picture files in the folder name 1.jpg, 2.jpg etc

  1. Specify different links
  • It is possible in more detail, it is worth landing, so there is no database there. - Yaroslav TheRock
  • You need somewhere to store data about the picture that was shown. For this, a database is suitable, or a file in which the current number of the image is written. The algorithm I wrote above. - blatube.com
  • I solved this already this question. Thank you. - Yaroslav TheRock