Embed Traccar Map to another website (Wordpress)

Alp Bal7 years ago

Hello,

Yesterday somehow i managed to install Traccar on my vps server. Also Managed to connect my phone as an object.
Now next step is embedding map to another website which is wordpress.
I searched forum and found a similar topic to this one. So i have downloaded the "simple" folder and edited the java app "in web UI from Anton Tananaev". And already setup readonly user and token.

But couldn't manage to connect my server from the website. I think i am editing wrong information to java app. Here what i have done.

var url = window.location.protocol + 'xxx.xxx.xxx.xx:8082' + window.location.host;
= (window.location.search.match(/token=([czHzEorBy7u7wHdiEDXjgqju7dXO3jzg]+)/) || [])[1];

This is the part i have edited.
I am just not very understanding these things .Newbie...

And 2. part embedding map to wordpress. Do i need someone to code a plugin for me? I can only copy paste some html codes to posts on WP. But here i can not see where to get embed code.
Thank you.

Anton Tananaev7 years ago

You don't need to edit any code. You just need to pass token as query parameter. I would recommend to integrate as a frame.

Either way you need some basic HTML and JavaScript knowledge to do it. It's not for newbies.

Alp Bal7 years ago

Sorry for being dump but i didn't understand. Here you wrote "You have to put correct user token into the script."
https://www.traccar.org/forums/topic/embedding-tracker-map-in-my-website/#post-13111

From this topic what i understood is i need to edit js file with my token and web url info.

From your answer what i understand i will use token in url? So i will put files in simple folder to public html on my server.
Then browse to url: server.com/token?

i have tired server.com loads a map but if i put a token in url i get 404
May be an example url parameter helps me?
Thank you.

Anton Tananaev7 years ago

The topic is from almost a year ago. Things change. You can now put token as a query parameter. Example:

http://demo.traccar.org/simple/?token=YOUR_USER_TOKEN
Alp Bal7 years ago

Thank you very much. This makes everything clean. For newbies simple examples better than 100 expert words. Because we just don't get it :). Thank you. Now i know what is a query parameter :)

Alp Bal7 years ago

Hello,
On demo server i have managed to create an account and login with token parameters.
But on my server not working. Resulting the same default Map . Even i tested typing random characters instead token but result is always same main page. Server seems like not checking the token/
After installing do i need to take aditional steps like creating database, connecting to Myphp, sql tables?
Or i may have dns problem?
i am using Centos7 vps and vestacp which installed ngix. Hosting wordpress website. Dns handeled by Cloudflare.
Thanks.

satilla7 years ago

Alp Merhaba,

Bu konu https://www.traccar.org/forums/topic/how-to-install-traccar-server-on-vps/ yardımcı olacaktır.
Takip cihazı konusunda yardıma ihtiyacın olursa, açık kaynak cihaza cartrac.org adresinden faydalanabilirsin.

Alp Bal7 years ago

@satilla tesekkurler, inceleyim.
Thanks.

Alp Bal7 years ago

Hello,
Tired many times. Changed the mysql settings. But i felt like app performance dropped and got disconnect errors, server became unstable.
Rolled back to the original settings.
Tested every possibilities and found out.
http://serverip:8082/simple/?token=xyz.... Working
http://server.com:8082/simple/?token=FTOybZAFC4VMK8yZhQAa5VJUGlFkD2jE Not Working
http://serverip/simple/?token=xyz... Not working either
So this means i have Dns problems? May be cloudflare?
Thanks

Anton Tananaev7 years ago

What server IP are you using? What's the DNS address?

Alp Bal7 years ago

Hello,
I have mailed you info sir.
Thanks.

Lpk naura4 years ago

in my case there is an error on app.js:112 WebSocket connection to 'wss://demo.traccar.org/api/socket' failed: Error during WebSocket handshake: Unexpected response code: 503 the traccar embedding. Has anyone ever had the same problem?