Dynamic Link Count no Klicks - firebase

I like to short an URL with Firebase to use this Shortlink for an QR-Code. So I setted up a new Project in Firebase, goes in to the Dynamic Links Section and created a new URL-prefix like https://mysitename.page.link.
After this I created a new Shortlink like https://mysitename.page.link/Posx.
Now, when I put this link into my Browser, it works correctly and the ShortURL took me to the right Place.
But in Firebase, the Counter of Klicks for this ShortURL stands still at 0.
How can I get Analytics Data like Google URL Shorterer Service bevore?
Thanks for Help.

Related

Ionic 2 Angular 2 plus How to remove parameters in URL Address?+

Long story short in my app the user receives an email notification which has hyperlink to open a certain record for a given id number. It looks something like this:
https://myappserver.com/?aid=12343551
The question I have is once the user opens the record is it possible to change the URL through ionic? I would like to change the url after opening and remove the parameter so it looks like this https://myappserver.com/
I can retrieve the URL through this.platform.url() but I don’t know how to change it.
You can use Location from #angular/common. Then you can use it like:
this.location.replaceState('/'). Here is the reference.
You could use the history function of the window object
window.history.pushState('', '', '/');
Which don't rely on Angular.

How to keep ID of post in state when opening a link in a new tab in ReactJS

I'm building react website which topic is Blogging... I made it to work, and i can open a link in the same tab, but when i go and open link in another tab, or just paste link of post in the url, in some another tab, i get that message that my ID is undefined, which is obvious because my state is null. Here's how my link looks like
const TitleLink = (props) => ( <h1 className="post-title"><Link to={{pathname: "/posts/"+props.titleSplited, state:{id:props.id}}} > {props.title} </Link></h1> );
and in page where i'm showing full post i get my id like this
var id = this.props.location.state.id;
And it works great until i open it in a new tab or paste post url in another tab. I tried with pushState, but again it wont work, so now i dont know what to do... It was working while i was passing ID of a post through URL, but i removed it because i dont want ugly URL, i want that my url looks like
http://mywebsite.com/posts/this-is-just-a-spam
and not
http://mywebsite.com/posts/83hjdjadt2642djxa/this-is-just-a-spam
only mutual thing i can get is title, so i thought to make a hidden field which will contain ref like this-is-just-a-spam and its value would be post id. I don't know is it good idea or not, i'm stucked with this already 3 days and i cant find solution... I would be very grateful if you could help me. Thanks

Generating random URL in AngularJS

I wish to see if it is possible to generate a random link each time an admin visits the admin page.
for example: instead of having: "".com/admin, there would be "".com/a93k, "".com/9dik. The page stays the same but just so the end-user can't access the page from the address bar.
Thanks as I am new and do not know how I can implement this.
In .config of your app put something like
window.adminHash = Math.random().toString(36).substring(2,6);
In your routing
url: '/' + window.adminHash
Then you can use "window.adminHash" if you want to redirect to your route, which will change every time you refresh the page
You can add www.test-example.com/admin/{provide some ID}
And If there isn't ID provide discard that URL, if it is provided you can make discrimination.

Linking to an external url stored in MongoDB with Angularjs

I have a basic CRUD application written using the MEAN stack. In this I have an 'issues' model of which a number of properties are stored, including an external url which a user inputs.
I am trying to display this url so when the user clicks on it they are redirected to an external page (i.e. new tab in the browser). I am using Angular for this part.
With my current code I am always opening a new tab with the following url (http://localhost:3000/www.google.com). Taking the Google homepage as an external url example stored in the database.
My current code looks something like this.
view-issue.client.view.html
<a ng-href="{{ trustUrl(issue.sourceUrl) }}">Click me!</a>
issues.client.controller.js
$scope.trustUrl = function(url) {
return $sce.trustAsResourceUrl(url);
};
I have also tried this solution already posted with the same result (Linking to external URL with different domain from within an angularJS partial).
Thank you for any help you can provide!

Bookmarkable URL with search parameters?

I have some search functionality in my page, which uses GET requests and a JSON backend.
I want that if I run a search, I get an URL in the browser, with all the parameters, which the user can bookmark.
Let's say my search is:
search?key=a
I put this code in the success callback of the search, to update the URL:
$location.path("/search?key=a");
But then my URL gets updated to:
search#/search%3Fkey=a
If the user bookmarks this, of course it will not run the search, it will just show the search page with a blank input field.
I already did the setup to show the search results when the user has the correct link - I added this to the controller:
if (location.search) {
$scope.callMyApi(location.search);
}
But when I'm using the links I get from AngularJS, like search#/search%3Fkey=a, $location.search() is empty.
$location.path(), on the other hand, has what I need:
/search?key=a
I could split this, and get the search string, and pass it to callMyApi. But it feels like I'm missing the Angular way to do it.
Already read the doc about $location and some articles about routing, but still don't know what I have to do.
You need to combine the location path method with search method. Something like
$location.path('/search').search({key:'a'});
Can you check documentation on how to use $location in developer guide.

Resources