Get URL for embedded image on rails - ruby-on-rails

I have created a certification platform and whenever a user gets a certification he/she gets a badge image link to add to his/her website.
When they do that I generate the image on my server-side. So, if they add the image url http://mycertification.com/badges/asdfasdfasdfasdf.jpg, it will check on my side if the image has been created and return it or, if not, create a new one.
I have now over 10000 certified users and I would like to check if they are embedding the badges and also where the badges are embedded. So, if the user from the website www.user1.com embeds the badge image on this website, I would like to track that.
I have created a model BadgeTracker with the user_id, the url and a counter. Simple as that. The counter works already, now I want to know the URL where the image is embedded!
Any ideas on how to achieve that?

As far as I know there is no way to track if the user put the embed code on their website. You could only track how many times the badge has been viewed (meaning loaded) in a browser. If this is the case then you may create a route that handles badge displaying, so once the browser tries to access this URL you collect the badge information from the params, save it in the DB and then simply return the badge image. Sorry if I got your question wrong...
If you're interested I could try to create a code snippet with the solution.

Related

How do I display user profiles around my area using xcode while buiding an app?

I need to access user profiles in my area for my app. Like accessing an image that a user uploads in my app. But I need to show all the images of all users in and around the area of the logged in user in my app.
I need help with this. :)
You can accomplish this by continously uploading the current location of each user , and when a logged in one tries to see other profiles in your server according to a specifed region you set loop for all users that exists in this region and send their profies as the search result

Branch.io Generate the link at web end and then retrieve in app

Looking to integrate the branch.io in such a way that the admin gets the deep link at web end where he adds the content. And then he manually post the link to some social media say Twitter,Facebook etc. then user clicks on that link and it will take the user to app or app store.
Is it possible, please guide how to handle this. I am quite confused about branch.io. As far i understood branch.io creates the link send via sms and user clicks and gets redirected to app or app store. Is my requirement valid? How to achieve this please guide. Already spent more than a half day on it.
(Full disclosure: I am on the Branch.io team)
This is actually a very common Branch use case, so it's fairly straight forward to implement.
1. Sign up for Branch
Easy step!
2. Integrate the SDK into your app
This is a fairly simple process that should take less than half an hour, and the latest step-by-step docs for doing this are always at the link above. I won't include the full instructions in this answer because Apple creates new roadblocks fairly regularly, and we often have to make small tweaks to the guide.
After you complete this step, any time a user opens a Branch link associated with your app, either your app will launch (if installed) or that user will be sent to the App Store page to download it.
3. Create your marketing link
The link above takes you to the Branch dashboard. From that page, you can create a new Marketing Link, and use the Deep Link Data section to specify a key/value pair. For example, you can set a key of content and assign it the value mycustomvalue:
When your app launches after a user opens this link, the content : mycustomvalue pair will be magically returned to you.
4. Configure Deep Link Routing and Universal Links.
These methods are what actually call back to the Branch API every time your app opens, returning the content : mycustomvalue pair that you encoded in the link. You can do whatever you like with these values, but here are two common approaches:
Route the user to the content that you specify corresponds to mycustomvalue.
Use the values directly to display something customized (for example, if you encoded content : You've been sent a special invitation!
5. Share the link wherever you like!
The link you created can be put anywhere. Email, Twitter, Facebook, paid Google Ads, etc.

how to update previously loaded data after user update his profile

I have one logical question.
I have one iOS app. which uses php mysql as backend. I am getting other user's feeds/Posts on the app home page. I am first getting latest post and saves it locally then display User Post and his details from local.
Now if some user has created one feed, that I will get and display at app side. after sometime if user changes his profile details(like changes his picture). So until that Post/feed updated I could not get know that the user has changed his picture. and every time user's old picture and details will be shown.
So can anyone suggest me which was the better way to update user's information? same like facebook does
Thanks.
Logical Answer:
Make an api in the backend which will return only the updated post.
From app side add a timer for around 3sec/5sec and call the api again and again, and refresh the feed with the current changes. If there is no changes you don't have to refresh the feed.
Make sure from the api you will return only changes not the whole feed again and again it will consume more data if you do so.

save text to default Notes app

I am working on app in which there is a textview with save button. On the click of save button I suppose to open the Notes app and save the text on notes. Same as we done to post the sms.
I also go through this given pdf file iPhoneURLScheme_Reference
But didn't find out the way to save the text/open the notes app from the app. If someone has ever done this type of functionality or having some idea please help me out.
Thanks in advance.
I don't expect there to be an URL scheme if it is not present in the PDF you linked to.
I wold expect it to be on this list however.
Looks like you can't do that.
If you consider the URL schemes in Apple's document you will notice that all of the schemes refer to an application the user is expected to interact with immediately (navigating with Maps, making a call,...). All these applications provide something you can't do your own. What would be the benefit of your app if it just allowed the user to write a note once?

Let sites know they were visited from WebView inside iOS App

I'm trying to figure out the best way I can inform analytics trackers that the page view is coming from my app, rather than a 'direct visit' (for example).
I have an app that displays a list view of tons of different news stories, and I want to make it so that, when a user taps on one of the stories, and it is displayed in my UIWebView, the website being loaded is somehow informed that the referral came from 'example-iphone-app', or maybe my iPhone app's website?
Is there any way to manipulate the http request to make the iPhone app act as if the link is being opened by a referral link on my website?
I was originally thinking of just adding a query string with a parameter like ?source=myappname, but realized this is not a reliable (or even useful) way of alerting site owners with Google Analytics, SiteMeter, Urchin, etc. from where the request has come.
If you're using Google Analytics then you can set the utm_source and utm_medium query parameters and they will be displayed as the referral source. utm_source is where you would put your myappname parameter and utm_medium should probably be set to referral unless you are charging per click then it is usually set to cpc.

Resources