Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...


Code Block
languagejs
themeEclipse
linenumberstrue
const share = function(){
navigator.share({
title: 'mobsted.com',
text: 'Check out mobsted platform',
url: 'https://mobsted.com/?utm_referal_objectid=#Object:objid#',
})
.then(() => console.log('Successful share'))
.catch((error) => console.log('Error sharing', error));
}

if (navigator.share) {
document.getElementById("btnShare").onclick = share
} else {
document.getElementById("btnShare").onclick = () => alert('Sharing does not work');
} 



NOTE the URL link above (line 5) - needs to lead to the place in your app, where you want to land all the new users. It can be a certain screen in your app, or a Common Access Link from the Security section of the app, or a screen in a landing-page kind of app, so not the same one from where sharing is made. All depends on the task at hand.

Title and text (lines 3 & 4)  - what the native sharing function of a user's device will show during the process.

...

It is done using UTM marks, so note the following in the code above (line 5 again ↑):

"?" denotes start of the URM mark

...


The general form is #Route:query:custom_name#. In the case on the picture above ↑ we called that custom_name as "utm_referal_objectid", which takes takes the UTM variable created on Step 2 (JS code line 5).



Thats all. Ask us anything we missed here.