magazinexperts / PHP-Maghub-API-Wrapper

PHP Wrapper for the Maghub API v1. Bug Reports and Pull Requests Welcome.
MIT License
2 stars 0 forks source link

Not an issue but a few questions #3

Open green-plastic opened 3 years ago

green-plastic commented 3 years ago

Hi,

I found your API wrapper and we just started down the path of using MagHub. Do you know if you're able to pull companies by letter? Can you pull companies with a current ad running?

Thanks!

magazinexperts commented 3 years ago

Hi @green-plastic You should talk to your Maghub Rep about adding you to their Slack community, there's a channel for Data Warehouse and API. Maghub also added new API documentation recently - INSTANTCE..maghub.com/api-documentation/v1/ once you're logged in

You can't pull companies by letter as is, but you can do a search. Depending on your use case, this is where data warehouse might be more useful. Right now there's not an easy way to get reports similar to production or snapshot reports in the API, but data warehouse can do much of that with ease.

I have a few other repos that might be helpful like a postman collection for the API https://github.com/magazinexperts/Maghub-Postman-Collection (improved upon their own but far from complete) and some example code for DW https://github.com/magazinexperts/maghub-datawarehouse-sql

green-plastic commented 3 years ago

Awesome. Thanks for the info. I'll reach out to our rep about Slack.

One more question, if you don't mind, I don't think we have the Data Warehouse but does it allow you to populate data on your own site in anyway?

magazinexperts commented 3 years ago

Data Warehouse is an addon, I think they offer it as part of a tech package for $100 a month. Data Warehouse provides read only mysql database. It's well worth it!

Normally it updates once a day, but if you ask, they can have it update twice a day, or every 2 hours. Not all data is in the data warehouse, but if something is missing, they're pretty responsive about adding it. There's also analytics views summarizing the data in a more reportable way.

You can very much use DW and the API together, such as building a web interface to display Data Warehouse data, that can then use an ID to fetch the latest, or additional data from the API, or even update certain things.

When setting up DW, they might ask you for an IP access you can use to access your DW - I'd recommend using a cheap server instead of an office static IP. You can find cloud VPS servers capable of running MySql, PHP and phpMyAdmin and allow access to desktop tools, starting at $5 a month, at Digital Ocean, Linode, Vultr, and UpCloud

Once you have Data Warehouse, you can connect to it a few ways:

  1. Direct MySql connection using apps like PhpMyAdmin, Metabase, ReDash, etc as well as your programming language of choice on the server.
  2. Mysql via SSH: MySql Workbench (native), MS Power BI Desktop (through some trickery), among many other mysql tools, will let you connect using ssh. Many cloud based data warehouses can also connect if you wanted to build your own commercial option.
  3. Maghub provides a Metabase install, but they're a little slow to update and they don't provide access to all functions - you can't manage permissions yourself. Their Metabase install can be used to build custom widgets on your dashboard.
  4. If you want to use or merge data to an existing database, you can use federated tables. These are a little tricky as if Data Warehouse adds a column, you'll have to update your federates table in order to see it, but this could probably be automated. If you already have an application you want to merge data with, federated tables are great.
  5. There's a data warehouse report in Maghub but its very limited.

We offer a digital stats platform to our advertisers. We also have a number of self hosted PHP & Mysql Reports that mimic or improve upon some of Maghub's reports. To make these, we use Data Warehouse and some magic.

We store IDs or other information in Ticket Dynamic Attributes. This is so we can merge tables later - some of this is merged using code (a PHP webpage with 2 database connections, one to an app, one to DW) and some can use federated tables to creative native mysql joins.

Then, we have a number of scripts and Zaps (Zapier Automations) that collect other data (Mailchimp opens, Google analytics pageviews, Ad Server impressions and clicks, to name a few)

We use federated tables to treat certain tables of DW as local data and then use a Mysql's built in Events and Routines to compact and cache the Data Warehouse federated tables into a local table. (For Speed, Federated tables are slow compared to a webpage).

Using this setup, our data is no more than 3 hours old at any given time that can be loaded into custom reports and apps.

TL;DR; Yes, DW can let you use a lot, but not all, Maghub data in your own site.

green-plastic commented 3 years ago

Wow, well I appreciate the long and thorough answer! Cheers!