Welcome to Rise Forums

Join our fantastic community to connect with like-minded website owners, WordPress users, and online entrepreneurs.

Category/page-level Targeting For Scripts In Wp?

Discussion in 'WordPress Questions & Support' started by Adam Connell, Sep 11, 2016.

Thread Status:
Not open for further replies.
  1. Hey folks,

    I'm planning to setup push notifications soon but I want to be able to pick and choose which posts/pages/categories they appear on.

    I found this, which allows me to choose where scripts fire based on post types: https://wordpress.org/plugins/oh-add-script-header-footer/

    But, it doesn't allow me to have page-level targeting or category targeting.

    Does anyone know of a plugin that does? Or a way of doing this?


    Thanks!
    Adam
     
  2. Hi Adam.

    This is not something I've looked into myself previously though I had a quick look and installed Header and Footer Scripts and Insert Headers and Footers.

    Both of these plugins have a settings page to add code to your global header and footer, but Header and Footer Scripts also allows you to add code to your header on posts or pages (not sure about other post types). There is no option for adding footer code on an individual basis.

    Kevin
     
  3. Hi Kevin,

    Thanks for sharing those plugins - much appreciated. One of them will be a good fit for one of my sites where I'm trying to exclude code from pages.

    But it's starting to seem like there isn't a plugin that offers the category/taxonomy level targeting at all.

    I'll keep hunting around :)
     
    Kevin Muldoon likes this.
  4. Hey Adam, didn't know you were on here too!

    Maybe you could do something manually for categories by using conditional enqueue with the "in_category" tag? I think that would let you conditionally load a script for only posts in certain categories you specify.
     
  5. Hey Colin, didn't know you were either. Good to see you on here.

    I haven't been active for a while - hoping to drop by more often.

    Sounds like a good option. Don't suppose you know of a tutorial that would explain how to load scripts in that way? My coding skills are very basic but could probably muddle my way through if I had a tutorial.
     
  6. This one is pretty good I think.

    My coding skills sound similar. I go for the old hack and pray approach :)

    Worst comes to worst, I think it would be pretty trivial for a dev.
     
  7. What type of push notifications is it Adam?
     
  8. That's quite useful Adam. I've never seen, or haven't noticed anyway, one of these push notification things that let you do it on a category basis before.

    Would it not be quite annoying for someone who was browsing through your site to keep getting authorisation messages though?
     
  9. Definitely. There are a lot of tools that allow adding of code, but it's rare to find any that give any options for targeting taxonomies which is very useful from a conversion standpoint.

    Yep, it would be annoying if they kept getting the message. But, the way push notifications work, you can choose to accept, block or dismiss. Blocking will stop them from popping up again.
     
  10. Thanks Adam, I've saved this thread, because I might make use of that soon too :)
     
  11. Sure thing, @Paul G :)

    Some extra info on Push Notifications:

    There are a bunch of tools that you can use for this such as PushCrew.com (upto 500 free subscribers, PushEngage.com (upto 2,500 free subscribers) and NotifyFox.com (upto 5,000 free subscribers but very new).

    I'm using PushEngage.com, good features on the free plan. Found NotifyFox after but it's a lot newer and migrating subscribers seems complicated (need to look into that more).

    There's also Onesignal.com that offers 100% free plans, but they sell data to make it free. Very cool if you don't mind that.

    Hope the extra info helps you and anyone else following the thread.
     
  12. Thanks and please let us know how it goes too. I've got a few web design / marketing type clients who might literally kiss my feet if I could show them real-life examples of how well this worked.
     
  13. Sure thing, @Paul G.

    I've got a few sites running these already.

    My agency has around 100 subscribers so far (we get them about twice as fast as email subscribers). And the first few push notifications we sent were around 20% click-through rate.

    My other site is getting them around 3-4x faster than we get email subscribers, but they seem to be less engaged. Only sent a few notifications - 5% and 10%.

    Early days yet though.
     
  14. Yeah, I'm using category level product feeds with Woocommerce now too. Amongst other things, I've got new products going out automatically to RSS Feed directories and via Dlvr.it to Pinterest and so on. Quite handy using the category level push notifications on your blog I suspect, but not so sure it would work for me. I'm thinking (or thunking, which is maybe more appropriate :))......

    Regarding the category level targeting, what I meant was are you going to have a different prompt on each category, so each category requires a separate subscription? That was the thing I thought might annoy people.
     
  15. @Rhys Wynne - most push notification tools have the option to pull from RSS, along with the option to send manually (or schedule manually).

    In this case, the targeting I'm looking for happens before any notifications are sent. It's just the box that says "this website wants to send you notifications - Allow/Block" that I'd like to stop from appearing on certain posts.

    My earlier idea of using the Plugin Organizer won't work unfortunately - it can block plugins from pages, but not individual posts.

    @Paul G - ah, you're right that would definitely annoy people having different subscriptions per category. From what I can tell, push notification subscriptions are only available on a side-wide basis. But the idea Rhys mentioned of using category RSS feeds would be a great alternative for you.
     
  16. If you add a snippet of code to your theme to display the push notifications then this header/footer plugin would work...

    https://wordpress.org/plugins/header-footer/

    It has an option on each post that lets you disable the header/footer injections.
     
  17. Thanks Paul - I've tried a few of those types of plugins, but didn't find one with that option. This one is exactly what I'm looking for :)
     
    Kevin Muldoon likes this.
  18. @Paul G - do you know of another 'header/footer code' type plugins that has the same options to disable on a per post/page basis?

    I tried Header and Footer but the code is still being injected for the posts where it's been disabled.

    Thanks!
     
Thread Status:
Not open for further replies.

Share This Page