'Show button when clicked on a element on cake php
Hello community i want to show a button when a ad was clicked (identify using class) and opened for at least 30s in cake php
button code
<?= $this->Form->button(__('Click here to continue'), [
'class' => 'btn btn-primary btn-captcha',
'id' => 'invisibleCaptchaShortlink',
]); ?>
And class = anything i will put the class by finding the class from ads. If the user closed tab until 30 seconds ends the user should be redirect to the same url where the user is ,like g.com/fhgsd not the ad url and also button will not appear
Solution 1:[1]
Depends on how you are showing the ads, you are not providing much information to work with, to be honest. In order to use ads for cake you need either a plugin or an API. I don't know much about plugins, because even If there are good ones, chances are they are no longer supported or developed.
To do it with an API: You have to read the documentation about the API from the site that shows the advertisements (Site you work with). They should be the ones handling it and sending you back data about how much the user has looked at the ad and what not. Then you get a response back, and you can read the values in cakePHP and work with them. I recommend using this program to test out the API responses and requests, then you can use HTTP Client for cake to convert those responses to PHP code. It can be rough, but once you find out how it really works, it gets easier.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |