Looking for a way to subscribe to events within my Shopify store - shopify

I work with some third party referral systems and I've been looking for a way to trigger some JS off of events like Add To Cart, Add Coupon to Order, and Checkout. I'd like to be able to do this without having to use the id of the button in question as these can change from theme to theme, and become complicated when you're dealing with multiple buttons for the same functionality.
It seems like the built in Google Analytics and Facebook Tracking are using some sort of event system to trigger their data collection, but I can't seem to find anything in the docs or forums explaining how this works or how I can use it without using their services. Ideally I'm looking for some kind of liquid if/then sort of structure or alternatively just a clear event of some kind that I can listen for.
Obviously I could use jquery to accomplish this by listening for different button clicks but that seems like a really brittle way of handling something that is clearly part of the core of how Shopify works.
Any thoughts or suggestions would be really appreciated (At this point I'll name my first born rumplestiltskin)
(Repost from here https://ecommerce.shopify.com/users/554977/posts)

You can subscribe to webhook events through the API:
https://help.shopify.com/api/reference/webhook
There are topics for carts/create and checkouts/create which you might find useful. For coupon codes, you can subscribe to orders/create webhooks and parse the order data to see if it contains a coupon code.

Do what everyone does, including GA and other trackers. Build an App that installs in shops, and that App uses the API to inject JS that triggers onload. You can then program the JS to callback your mothership with the data you are interested in.
Note that your approach of asking for a trigger is far too vague to ever work. Why re-invent the wheel or beat a dead horse. Free up your valuable time and just go with the flow.
https://help.shopify.com/api/reference/scripttag

Related

Shopify App Necessary? Hard-code into Theme?

I have much experience developing for WordPress but this will be my first project developing for Shopify.
I will be customizing a 3rd-party Shopify Theme with custom functionality as per the client's website needs. I've been reading much documentation but I am still a bit confused about Shopify Apps...
My question is:
Do I need to build an App to extend the functionality of my theme, or can I just hard-code the new functionality directly into the theme? Is there any reason to develop an App for functionality that will only be used on my theme?
I thank you very much for your advice.
Do I need to build an App to extend the functionality of my theme, or can I just hard-code the new functionality directly into the theme?
Short answer: Yes. (Damn that mathematician's response!)
Is there any reason to develop an App for functionality that will only be used on my theme?
Longer answer: Sometimes, yes.
That wasn't very helpful
Longest answer: True. Let's break it down a little more, then.
Without knowing what you need to do, I can't offer a concrete yes-or-no answer to the question, "Should I build Feature X as an app?"
If you...
Need to add, modify or delete any objects that require admin privileges (including products, variants, collections, orders, etc.), or...
Need to listen for any of Shopify's webhooks, or...
Need to store data in an external database for any reason...
... you will need an app to have the permissions required to access and manipulate data at this level.
However, if you...
Can do everything you need with the existing Shopify objects, and...
Need few or no settings to control the desired behaviour...
... you would not need to create an app. Shopify themes have some powerful tricks & tools available to you, including:
The ability to create custom endpoints for any of the main types of objects to get the data you need;
Easily-edited settings_schema file to add arbitrary configuration variables to help control your mini-app;
Javascript endpoints to let you add, remove & edit products in the cart
Hopefully this quick breakdown helps you decide if you need to create an app or not. (And to anyone who does need to make a single-site app, remember that Shopify lets you create 'Private Apps' that don't have to go through the app store process to get widespread approval)
I thank you very much for your advice.
You're welcome! Hopefully it proves to be helpful. Good luck!

Does the PayPal API allow you to assign a price based on an algorithm? If so, how?

I have been reviewing this forum and the documentation for PayPal API but am still uncertain about one thing: Can I have an algorithm determine the price of certain services on a PayPal button (rather than designing a bunch of preset buttons and choosing which one to display)? I would like to have this information feed in from an external database and would appreciate any tips on which lever to pull.
Thank you!
You would have to make sure it's not a hosted button, which would make the amount be included in a hidden field with the form button. Then you could dynamically adjust the amount based on any logic you want.
The down-side to that is the button isn't as secure because people could view source, copy the HTML, change the amount, and then submit the payment that way. Of course, there are ways to manage this, but it's something to consider.
Another option would be to use the Express Checkout API instead, in which case it would be completely secure and fully customizable to handle pricing however you need to.

How to get in touch with the users of your WP7 apps?

This is a problem that every developer will face when building their apps: how to contact the reviewer of your app to notify them of an update, new release, help topics, etc?
Some things I am thinking:
Include an RSS feed in your app which you can update to notify the users of the app.
Include a twitter feed regarding your app. How to go about this?
Include a way for the users to subscribe to a mailing list. This way, I can send a mass-email to the users who opted-in? Any suggestions here?
Any other ways that you think this can/should be done? Any existing solutions you can point me to will be great. Thanks in advance.
One way, for contacting a specific user who created a review of an application is to go to Zune Social (at http://social.zune.net/home) and create a new message. You can then enter the Zune Tag of the user who created a review.
Personally, I'd try to do all three - have a web page/site, with an RSS feed, and a subscription link (so they can subscribe to the RSS feed via email) and then post any updates to your twitter account as well.
You can't really force a user to do any of these, but having the options available, and linked from inside your app on the about page is probably good practise.
You could also include some kind of "Update Available" feature inside the application. Try to make this as unobtrusive as possible obviously. Obviously if they've still got the app installed they'll get an update notification from the marketplace anyway.
Sam
Besides the suggestions made by samjudson, I'll also recommend having a support-page with a direct option to send a email to you. Here's a example of a support-page from one of my applications. I've received lot of emails with suggestions for improvements, or complains about bugs. And since it's by email, it gives you the option to respond directly to people.
Another thing about reviews. Don't take them to serious. Most people only rate negatively (since humans like to complain), and by such a lot of reviews are often misinformed, outdated, or the users just been plain ignorant.

Automatic notification without an API

My school is using a website to manage grades, homework and communication with teachers. Because there is no way to get automatic notification, most students have to use it daily to check manually if there's an update (new message, new grade, etc). Since their service has no API, what should I do to get automatic notifications.
Is there any tools available that automatically notify you (by email or rss feed) of any change in a page by authentifying and checking if the value of a specific field changed?
Should I code my own script?
Is there any tool or library out there that could make this task easier?
Thanks in advance for your answers.
https://www.changedetection.com/
Not sure if it works for secure websites, though.
I just found something interesting. It's called Scrapy. It's an application framework that makes data-mining and structured data extraction easier.
Has anyone experience with Scrapy? Could it solve my problem?

TurboGears for ecommerce

Is there a good Open Source shopping cart implementation for TurboGears? (I found Satchmo for Django, but I'm coming up empty handed for TurboGears.) I'd like to avoid reimplementing this particular set of wheels.
No, I do not believe there is.
You might want to take a look at stroller it's a library to add ecommerce features inside turbogears2 apps. It supports both manual payments handling, dispatching and paypal payments. It is meant to be used without forcing users registration.
It is still in playground status and is missing documentation, but should be quite easy to mount it inside your app and start playing with it.