I made a REST API with Laravel, basically I get they route pass the route to the controller and from the controller I get the data and return a json formatted response, I was wondering If there is any way to add Google Analytics tracking to this.
Thanks.
Your best bet seems to be the Google Analytics Measurement Protocol:
https://developers.google.com/analytics/devguides/collection/protocol/v1/
Also, since Laravel has the ability to run packages, it appears someone has already created an appropriate package for Laravel:
https://github.com/irazasyed/laravel-gamp
Note - I have not tried this package so I can't say whether it will save time over implementing the calls directly according to the GAMP docs.
Related
I am trying to track a shipment to get the status and date of it. For that I was checking the DHL documentation from the site in Germany, but is not really good to be honest.
Anyways, there's a testsuite which I downloaded and read, and there they say:
If you are working with the GET method, you can also view the link,
all necessary information is contained in the URL.
Here you will find the complete URL as the first entry:
GET
https://cig.dhl.de/services/sandbox/rest/sendungsverfolgung?xml=%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22%20standalone%3D%22no%22%3F%3E%20%3Cdata%20appname%3D%22zt12345%22%20language-code%3D%22de%22%20password%3D%22geheim%22%20piece-code%3D%2200340434161094015902%22%20request%3D%22d-get-piece-detail%22%2F%3E%20
HTTP/1.1
You can also put this link into your browser. (doing that doesn't work for me)
That link supposed to output in XML format.
So my question is...How can I get the info from that URL in PHP? to then be able to retrieve the specific info in it.
I think the best way will be to use this library which implements the DHL API methods quite well:
https://github.com/alfallouji/DHL-API
You might also refer to this post where they discuss different ways of using the API:
DHL Tracking Api and PHP
Is there any way to access Twitter analytics api and data with some kind of php library or something?
I want to access my own account data and I want to create a php app that allows me to get that data and show it in a different way (Html,Css).
I got my tweets and other stuff with his twitter API and with some libraries, but now I need to get data from twitter analytics.
I have read some topics about this in stackoverflow, but social media's api changes all the time and I want to know if it is possible to do this right now, or if someone has discovered a way to do it.
Thanks.
No API unfortunately, just a hackish way (Selenium) in Python that I created as a package.
$ pip install twitter-analytics
More here: https://github.com/philippe2803/twitter-analytics-wrapper
The application I am migrating into Laravel 5 is a website and its API.
The API is used for the mobile apps and for the website to pull the data.
The website will not be developed to be a Single Page App, because I already have all the views and I'm just migrating the website to Laravel 5.
How can I do the following without duplicating my code?
For instance, allow /products to list all my products using this API endpoint (/api/2.0/products).
The same applies to all other routes
Yes you can. I am currently doing this myself. Writing the base API first and then dogfooding it for my own website. There is a good laravel package called Dingo ( https://github.com/dingo/api ) that can give different output depending on where you call it from.
If you call it simply from api.yourwebsite.com/products you will get JSON. but if you call it internally like API::get('/products') you will get array/object whatever you're returning instead.
So I have a website that is using the API to render itself. This way, you only write the API once, and can use it for your frontend website, mobile, or give it to third party developers too.
I hope this answers your question. If you have any more questions, please let me know. Thanks
You can do it by creating repositories for your code.
Then create separate controllers for both APIs and Website. Through that your code doesn't duplicated and you can access that repository from both the controllers and return response accordingly.
I am making a system where a users account can pull in details about their Facebook, Twitter and a few other API's.
I have been doing it so it brings in the data into the Controller, but is this the right thing to do? I know that "Codeigniter is great because you can use it any way you want it just depends on how you feel comfortable" etc etc but I find I am repeating myself sometimes if I have to bring in latest Tweets in more than one controller, for example.
Thanks in advance
To use an API you have to download API required files in libraries folder and then load library into the controller.
You are then good to go to make API calls.
Here is a sample tutorial:
http://codezone4.wordpress.com/2013/05/19/codeigniter-facebook-login-tutorial-using-facebook-php-sdk/
Why not create libraries for each, then initialize library to the controllers where you want to use the data.
This is how you create library in CodeIgniter.
Is there a way to retrieve a JSON or XML resource from Google Docs using an HTTP GET? I want to list public-only docs belonging to me on a web page, so the user viewing the web page should not need authentication or even to have a Google account.
I can do this easily in the Blogger API.
https://www.googleapis.com/blogger/v3/blogs/blogId/posts
Don't really care the method (writing in PHP) for retrieving the data, but I want it to happen server side and it should not require authentication by the user.
Have I missed something?
You can use the Google Documents List API. I believe it only requires auth for non-public data retrieval.