doublesecretagency / craft-adwizard Goto Github PK
View Code? Open in Web Editor NEWAd Wizard plugin for Craft CMS
License: Other
Ad Wizard plugin for Craft CMS
License: Other
This issue doesn't occur if no Field Layouts have been created in AdWizard since the Field Layout dropdown is not displayed.
When creating a group, the Field Layout should allow for empty value even if Field layouts exist.
TypeError: Cannot assign string to property doublesecretagency\adwizard\models\AdGroup::$fieldLayoutId of type ?int in /var/www/html/vendor/doublesecretagency/craft-adwizard/src/controllers/AdGroupsController.php:142
Stack trace:
#0 [internal function]: doublesecretagency\adwizard\controllers\AdGroupsController->actionSaveGroup()
#1 /var/www/html/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#2 /var/www/html/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams(Array)
#3 /var/www/html/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction('save-group', Array)
#4 /var/www/html/vendor/craftcms/cms/src/web/Application.php(341): yii\base\Module->runAction('ad-wizard/ad-gr...', Array)
#5 /var/www/html/vendor/craftcms/cms/src/web/Application.php(642): craft\web\Application->runAction('ad-wizard/ad-gr...', Array)
#6 /var/www/html/vendor/craftcms/cms/src/web/Application.php(303): craft\web\Application->_processActionRequest(Object(craft\web\Request))
#7 /var/www/html/vendor/yiisoft/yii2/base/Application.php(384): craft\web\Application->handleRequest(Object(craft\web\Request))
#8 /var/www/html/web/index.php(12): yii\base\Application->run()
#9 {main}
Just installed this plugin, and one of the first thing our clients are asking for is how can they in future download stats as a CSV for reports.
Seeing graphs like on the dashboard just within Ad Wizard 'Stats' page is also a question raised.
It would be great also if the graphs on the widgets were not by group, but there was an All
option to see totals over all groups, but also to have an All
option to "Select Ad", so we can see totals per group, not per advert.
Hi,
We have a client who is unable to edit any adverts due to memory limits being exceeded when trying to navigate from either the Stats or Ads pages into an entry. Locally, upping my memory limit for the site to 1024MB restored functionality, but that seems excessive and is potentially indicative of another issue. Our production server has a 256MB memory limit meaning we cannot restore functionality on the live site.
Would it be possible for you to investigate any potential cause of this memory issue?
Thanks.
Craft version: 3.7.37
Ad Wizard version: 3.1.4
Hi,
I am working on Svelte project connected to headless Craft via GraphQL and would like to fetch Json data for the ads as well. My workaround right now is to create a template that puts out Json but I would love to talk directly to GQL.
Thanks
When users have ad blockers installed, ads will be prevented from being displayed, but they still register as having been viewed in the admin dashboard. Please note this refers to the version for Craft 2.
System Settings:
Required via composer and installed via craft cli just fine but when attempting to do the migration it fails because it's trying to use Fields::assembleLayout which was deprecated in 3.5.
╰─❯ ddev php craft up
Checking for pending Craft and plugin migrations ...
Total 1 new Ad Wizard migration to be applied:
- m180925_000003_adWizard_createFieldLayout
Apply the above migration? (yes|no) [no]:yes
Create database backup? (yes|no) [no]:no
Skipping database backup.
*** applying m180925_000003_adWizard_createFieldLayout
Exception: Calling unknown method: craft\services\Fields::assembleLayout() (/var/www/html/vendor/yiisoft/yii2/base/Component.php:300)
#0 /var/www/html/vendor/doublesecretagency/craft-adwizard/src/migrations/m180925_000003_adWizard_createFieldLayout.php(70): yii\base\Component->__call('assembleLayout', Array)
#1 /var/www/html/vendor/doublesecretagency/craft-adwizard/src/migrations/m180925_000003_adWizard_createFieldLayout.php(35): doublesecretagency\adwizard\migrations\m180925_000003_adWizard_createFieldLayout->_createFieldLayout()
#2 /var/www/html/vendor/craftcms/cms/src/db/Migration.php(49): doublesecretagency\adwizard\migrations\m180925_000003_adWizard_createFieldLayout->safeUp()
#3 /var/www/html/vendor/yiisoft/yii2/console/controllers/BaseMigrateController.php(758): craft\db\Migration->up()
#4 /var/www/html/vendor/craftcms/cms/src/console/controllers/MigrateController.php(361): yii\console\controllers\BaseMigrateController->migrateUp('m180925_000003_...')
#5 [internal function]: craft\console\controllers\MigrateController->actionAll()
#6 /var/www/html/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#7 /var/www/html/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams(Array)
#8 /var/www/html/vendor/yiisoft/yii2/console/Controller.php(180): yii\base\Controller->runAction('all', Array)
#9 /var/www/html/vendor/craftcms/cms/src/console/ControllerTrait.php(90): yii\console\Controller->runAction('all', Array)
#10 /var/www/html/vendor/yiisoft/yii2/base/Module.php(552): craft\console\controllers\MigrateController->runAction('all', Array)
#11 /var/www/html/vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('migrate/all', Array)
#12 /var/www/html/vendor/craftcms/cms/src/console/Application.php(91): yii\console\Application->runAction('migrate/all', Array)
#13 /var/www/html/vendor/yiisoft/yii2/base/Controller.php(212): craft\console\Application->runAction('migrate/all', Array)
#14 /var/www/html/vendor/craftcms/cms/src/console/Controller.php(208): yii\base\Controller->run('migrate/all', Array)
#15 /var/www/html/vendor/craftcms/cms/src/console/controllers/UpController.php(66): craft\console\Controller->run('migrate/all', Array)
#16 [internal function]: craft\console\controllers\UpController->actionIndex()
#17 /var/www/html/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#18 /var/www/html/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams(Array)
#19 /var/www/html/vendor/yiisoft/yii2/console/Controller.php(180): yii\base\Controller->runAction('', Array)
#20 /var/www/html/vendor/craftcms/cms/src/console/ControllerTrait.php(90): yii\console\Controller->runAction('', Array)
#21 /var/www/html/vendor/craftcms/cms/src/console/Controller.php(217): craft\console\Controller->traitRunAction('', Array)
#22 /var/www/html/vendor/yiisoft/yii2/base/Module.php(552): craft\console\Controller->runAction('', Array)
#23 /var/www/html/vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('up', Array)
#24 /var/www/html/vendor/craftcms/cms/src/console/Application.php(91): yii\console\Application->runAction('up', Array)
#25 /var/www/html/vendor/yiisoft/yii2/console/Application.php(147): craft\console\Application->runAction('up', Array)
#26 /var/www/html/vendor/craftcms/cms/src/console/Application.php(122): yii\console\Application->handleRequest(Object(craft\console\Request))
#27 /var/www/html/vendor/yiisoft/yii2/base/Application.php(384): craft\console\Application->handleRequest(Object(craft\console\Request))
#28 /var/www/html/craft(13): yii\base\Application->run()
#29 {main}
*** failed to apply m180925_000003_adWizard_createFieldLayout (time: 0.040s)
0 from 1 migrations were applied.
Migration failed. The rest of the migrations are canceled.
Restore a database backup before trying again.
Aborting remaining tasks.
Failed to run php craft up: exit status 1
Hi,
It could be a great feature to save the ads Field layouts
in the config/project.yaml
Right now, we have to sync them manually on the different environments, and i'm working with 5 environnements so for every push i have to edit 5 times the layout on my differents environments.
Thanks.
URL field has red *
next to URL field that symbolizes that it is required. But we still can save it with this field empty. Ad just wont be displayed in such case.
Maybe make it so that in such case ad would still appear but it would do nothing when clicked?
The file is called adwizard.js:
. This causes it to be blocked by scripts like ublock - ad
part is probably making it discovered for what it really is :) Why not set file name as something like svsgsjkfnshbkub.js
? Or allow changing filename using plugin config file.
Hi there!
I am trying to use your plugin on one of our client projects, but sadly it doesn't seem to run on PostgreSQL. All of the template tags end in the same error messages:
SQLSTATE[42883]: Undefined function: 7 ERROR: operator does not exist: boolean = integer
LINE 4: WHERE ("ads"."id"=$1) AND ("elements"."enabled" = 1) AND ("a...
^
HINT: No operator matches the given name and argument types. You might need to add explicit type casts.
The SQL being executed was: SELECT "ads"."id"
FROM "adwizard_ads" "ads"
INNER JOIN "elements" "elements" ON "ads"."id" = "elements"."id"
WHERE ("ads"."id"=31829) AND ("elements"."enabled" = 1) AND ("ads"."assetId" IS NOT NULL) AND (("ads"."startDate" <= '2021-01-23 20:03:52') OR ("ads"."startDate" IS NULL)) AND (("ads"."endDate" >= '2021-01-23 20:03:52') OR ("ads"."endDate" IS NULL)) AND (("ads"."totalViews" < "ads"."maxViews") OR ("ads"."maxViews" = 0) OR ("ads"."maxViews" IS NULL))
ORDER BY RAND()
LIMIT 1
I'm nowhere near being a PHP expert, and fiddling with source files is not something I would normally do, but this project strongly relies on an ad solution that AdWizard provides, and it seems like you guys monopolized this area of the Craft plugin store :P I gave it a shot and here's what I found:
Changing the query in getValidAdId()
in /src/services/Ads.php a bit does the trick, but it's not a valid long term solution, since we are running composer install
during deployment overwriting any manual changes I make to the plugin :(
The changes I am referring to are:
line 219:
->andWhere('[[elements.enabled]] = 1')
=> ->andWhere('[[elements.enabled]] = true')
line 224:
->orderBy('RAND()')
=> ->orderBy('random()')
Any chance this could get fixed and released in the foreseeable future?
It would be great if the plugin natively handled debouncing, so a page refresh wouldn't immediately add another view to the total.
Easily generate the onclick
event for an ad, for use elsewhere...
{% set onclick = ad.getOnclick() %}
... would set the value to...
adWizard.click(99, 'http://example.com/')
That is the JavaScript function which will log a user's click event. This is useful if some nearby HTML also needs to react to the same onclick
event. Or if, for some reason, the click event needs to be removed from the img
and placed elsewhere.
Do You have any plans to add the multisite support? So an ad might be published on some sites and not on others (lets say on EN sites, not on germen versions… etc).
Hi Lindsey,
It would be great if you could restrict the uploadable types to just be images. We're seeing some clients upload PDFs of their ads. I think you said in a previous ticket you mimic the functionality of the native asset selector, which has restrictions I think? Not sure. Would be great to see either way
Thanks
I really, really want to be able to restrict the main asset upload for the ad graphic to a particular subfolder -- currently the interface for it allows selection of any image in any asset volume, and it's extremely easy for clients to put stuff in the wrong place if making a new ad via the backend.
In my opinion, a good place to put it would be in the settings for an Ad Group.
Even if ads are not links, they are supposed to emulate their behaviour using Javascript.
That's why I propose adding auxclick
event handler to ads HTML elements that would allow opening them with middle mouse button.
A useful function for the Ad Wizard plugin would be to send out an email whenever an Ad is about to expire.
Rules should be able to configured to say "Send reminder 1 week before, Send reminder 2 weeks before, ..." or custom, to notify the user that the running ad is about to expire.
Ideally this could have more functionality to make it even more useable:
Basically, since the entire site's Settings control panel section is hidden when allowAdminChanges
is false
it makes sense to hide this section as well to prevent front-end users from being confused by these options.
Additionally / alternatively, it might be nice to have some increased flexibility for setting individual user permissions to hide some other features on a production site that might not be editable.
For example, disabling the ability to Add new Ad Groups, or alternatively the ability to hide the "Ad Groups" menu item entirely if it doesn't make sense for them to be edited on production.
Could a Freeform submission automatically create an Ad?
"We're trying to set up a way to submit ad content from the site (the site is a local online newspaper)..."
This request came in via email. I'm not sure if it's is entirely possible, but it's worth looking into.
Just like it works with adding new fields in Craft.
<figure onclick="adWizard.click(99, 'http://example.com/')">
<img src="advertisement.jpg" alt="My Advertisement">
<figcaption>User entered caption for advertisement.</figcaption>
</figure>
https://www.w3schools.com/TAGS/tag_figcaption.asp
This would make it easier for users to add captions (which would be affected by the onclick
event).
Is it possible to import banners with Feed me?
This widget implies that we are looking at the lifetime totals for each ad. However, these are actually just the totals from the current month...
Bug report: Can these be brought into alignment? Are we supposed to be looking at the lifetime totals or the monthly totals?
Feature Request: Let's do both. Provide a setting on the widget which allows you to choose "lifetime" or "monthly".
Right now, Ad Wizard lets you upload images to any volume you want. It would be great if those uploads could be restricted to a specific folder, to prevent client errors.
Problem: The current behaviour calls window.open() on ad click which is blocked by most browsers.
My request to change the implementation so it adds a regular anchor tag to _blank with a href of ie //mypage/ad-click?id=1234 which is an action that returns a header with a redirect to the URL of the banner ad. This way the browser wouldn't block it and we could still count the clicks.
Related to #6 but I've not got an adblocker switched on. Running the latest version of adWizard, Craft 3.3.20.1.
We are using Blitz Cache (which might be relevant, as you mentioned this on the previous issue). It's injected onto the page using {{ craft.blitz.getTemplate('ism/includes/_adwizard') }}
, and the include is pretty much some divs and the init for adWizard i.e. {{ craft.adWizard.randomizeAdGroup('leaderboard') }}
It's like it's not registering the asset bundles correctly on the front end, as I can't see the superagent.js
and adwizard.js
in my network tab.
Thanks!
I had to uninstall the plugin from a site and during the uninstall process I got this error:
*** uninstalling ad-wizard
> dropping {{%adwizard_ads}} if it exists ... done (time: 0.002s)
> dropping {{%adwizard_groups}} if it exists ... done (time: 0.001s)
> dropping {{%adwizard_fieldlayouts}} if it exists ... done (time: 0.001s)
> dropping {{%adwizard_clicks}} if it exists ... done (time: 0.002s)
> dropping {{%adwizard_views}} if it exists ... done (time: 0.002s)
> delete from {{%fieldlayouts}} ... done (time: 0.004s)
> delete from {{%elements}} ... done (time: 0.004s)
> delete from {{%elementindexsettings}} ...Exception: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'websitead1.elementindexsettings' doesn't exist
The SQL being executed was: DELETE FROM `elementindexsettings` WHERE `type`='doublesecretagency\\adwizard\\elements\\Ad' (/srv/www/website.com/vendor/yiisoft/yii2/db/Schema.php:676)
#0 /srv/www/website.com/vendor/yiisoft/yii2/db/Command.php(1307): yii\db\Schema->convertException()
#1 /srv/www/website.com/vendor/yiisoft/yii2/db/Command.php(1102): yii\db\Command->internalExecute()
#2 /srv/www/website.com/vendor/yiisoft/yii2/db/Migration.php(299): yii\db\Command->execute()
#3 /srv/www/website.com/vendor/doublesecretagency/craft-adwizard/src/migrations/Install.php(185): yii\db\Migration->delete()
#4 /srv/www/website.com/vendor/doublesecretagency/craft-adwizard/src/migrations/Install.php(46): doublesecretagency\adwizard\migrations\Install->deleteElementData()
#5 /srv/www/website.com/vendor/craftcms/cms/src/db/Migration.php(82): doublesecretagency\adwizard\migrations\Install->safeDown()
#6 /srv/www/website.com/vendor/craftcms/cms/src/db/MigrationManager.php(294): craft\db\Migration->down()
#7 /srv/www/website.com/vendor/craftcms/cms/src/base/Plugin.php(165): craft\db\MigrationManager->migrateDown()
#8 /srv/www/website.com/vendor/craftcms/cms/src/services/Plugins.php(621): craft\base\Plugin->uninstall()
#9 /srv/www/website.com/vendor/craftcms/cms/src/console/controllers/PluginController.php(322): craft\services\Plugins->uninstallPlugin()
#10 /srv/www/website.com/vendor/craftcms/cms/src/console/controllers/PluginController.php(181): craft\console\controllers\PluginController->_uninstallPluginByHandle()
#11 [internal function]: craft\console\controllers\PluginController->actionUninstall()
#12 /srv/www/website.com/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array()
#13 /srv/www/website.com/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams()
#14 /srv/www/website.com/vendor/yiisoft/yii2/console/Controller.php(180): yii\base\Controller->runAction()
#15 /srv/www/website.com/vendor/craftcms/cms/src/console/ControllerTrait.php(87): yii\console\Controller->runAction()
#16 /srv/www/website.com/vendor/craftcms/cms/src/console/Controller.php(217): craft\console\Controller->traitRunAction()
#17 /srv/www/website.com/vendor/yiisoft/yii2/base/Module.php(552): craft\console\Controller->runAction()
#18 /srv/www/website.com/vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction()
#19 /srv/www/website.com/vendor/craftcms/cms/src/console/Application.php(90): yii\console\Application->runAction()
#20 /srv/www/website.com/vendor/yiisoft/yii2/console/Application.php(147): craft\console\Application->runAction()
#21 /srv/www/website.com/vendor/craftcms/cms/src/console/Application.php(121): yii\console\Application->handleRequest()
#22 /srv/www/website.com/vendor/yiisoft/yii2/base/Application.php(384): craft\console\Application->handleRequest()
#23 /srv/www/website.com/craft(13): yii\base\Application->run()
#24 {main}
*** failed to uninstall ad-wizard: An error occurred while executing the "doublesecretagency\adwizard\migrations\Install migration: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'websitead1.elementindexsettings' doesn't exist
The SQL being executed was: DELETE FROM `elementindexsettings` WHERE `type`='doublesecretagency\\adwizard\\elements\\Ad'
Try again with --force.
CraftCMS: 4.4.10
Plugin: 3.3.0
PHP: 8.2.x
I'm having a really hard time wrapping my head around this one. 😵💫
The aw.js
and superagent.js
script tags are not being added to the rendered HTML (even in prod which had been working well for months).
I can't figure out if this is something happening on my browser (I've tried chrome, arc, firefox, safari and they all do the same thing), or something bizarre like it getting striped out on its way (mitm)?
Yesterday I tried it for a couple hours with no luck. This morning it seemed to work fine for a bit in local (ddev). And now it's broken again.
Anyone else seeing this? Any suggestions on what could be causing it or how to troubleshoot it?
Sorry if this seems off-the-wall but I'm not seeing this happening with anything else.
Hi,
I have bought a licence and find this a nice plugin.
However, when deploying to production I get the following error code
Uncaught ReferenceError: adWizard is not defined
at HTMLImageElement.onclick (VM32:135)
The problem is that the click does not work anymore. So the ad is displayed but clicks dont work.
See yourself: https://knxtutorial.com/
This is really bad and makes the whole module obsolete. Any ideas how to fix that?
Everything works find on local machine.
EDIT:
Just found out that the JS missing on PROD.
The 2 lines are not added
Thanks-
I'm getting a console error: adWizard is not defined
when clicking on an ad. My expected behaviour was for the URL associated with that ad to open.
I am getting an error when I try to pass in image transforms on craft 4.
getAssetTransforms is no longer supported in this way. https://docs.craftcms.com/api/v4/craft-web-application.html#public-methods
Here is the problem line: https://github.com/doublesecretagency/craft-adwizard/blob/v3-dev/src/models/Config.php#L150
The Image field has the following label:
If no graphic is associated, the ad will not be displayed.
But an ad without a graphic gives the following error:
Argument 1 passed to craft\services\Assets::getAssetById() must be of the type integer, null given, called in /vendor/doublesecretagency/craft-adwizard/src/services/Ads.php on line 156
Running project-config/apply
to install AdWizard throws an error because it attempts to redirect after install, which isn't available via CLI
./craft project-config/apply
Installing plugin "ad-wizard" ... error: Calling unknown method: yii\console\Response::redirect()
Aborting config apply process
Thanks!
If the image exists in a volume with "public URLs" disabled, a broken image will appear.
Instead, it should be impossible to load an ad which has an image from a non-public volume.
Hey,
Is it possible to edit the instructions
for the default image field
? I would like to add a different text wich specify the minimum size needed for the image.
Thanks.
In Craft 4.3.3, it is not possible to edit an Ad from the "Ads" section. You can still edit an Ad via the "Stats" section, fortunately.
It may be a results of recent changes in the CP UI. Will have to dig a little deeper to get it resolved.
I have installed Craft CMS 3.7.36 version and tried to install the plugin but the below error occurred.
Migration: doublesecretagency\adwizard\migrations\m180925_000002_adWizard_portDetailsField
Exception: Ad Wizard migration error: Unable to create "Details" field.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.