Show Map Icons Depending on User Acess


Lets say for example I have this map:

And I have an admin access and user access. Can I configure the map widget so that some icons will only be visible to the people with admin access?

I don’t think is possible to do such thing only in the MAP widget. You should restrict the access of the device for each user, maybe you could create two devices, and add both at the Map widget, and change on the ACCESS menu page for the permissions for these devices.

I hope this helps. Filipe.

Usually to achieve that you need to create a device for each customer (just a dummy device, with HTTPs connector), then write an analysis to get the variable location for each device you want the customer to see, and then copy it to the dummy device of the customer.

Make sure you copy the data for the same variable, and add series for each data (based on the Device ID). It is good if you delete the previously stored data for that variable and serial too.

Then you can just create a blueprint dashboard and configure it to the dummy device.
In the Map Widget, you choose to see the variable for that device and turn on the switch for “Show Icon for all values”.


The following analysis should be a good starting point:

const { Account, Device, Utils, Analysis } = require('@tago-io/sdk');

// Function to copy to dummy device.
async function copyToDummyDevice(account = new Account(), dummy_device = new Device(), device_id = '') {
  // Get the device token and instance device class.
  const device_token = await Utils.getTokenByName(account, device_id);
  const device = new Device({ token: device_token });

  // Fetch the last location on the device, result is an array, so [last_location] automatically access index 0 of the array.
  // variable we're trying to fetch is location.
  const [last_location] = await device.getData({ variables: ['location'], qty: 1 });
  if (!last_location) return; // stop if no variable location was found in the device.

  // Delete any previous value for the variable location, with serie of the device_id
  await dummy_device.deleteData({ variables: 'location', series: [device_id] });

  // Insert the data location, with the serie being the device_id.
    variable: 'location',
    value: last_location.value,
    location: last_location.location,
    serie: device_id,

// Starting point of the analysis.
async function startAnalysis(context, scope) {
  const account = new Account({ token: 'Your-Account-Token' });

  // Fetch the list of devices filtered by tag key "device_type" and value "customer"
  const customer_devices = await account.devices.list({ fields: ['id', 'name', 'tags'], filter: { tags: [{ key: 'device_type', value: 'customer' }] } });
  for (const customer_dummy_info of customer_devices) {
    // Search for the tag customer_id on the dummy device.
    const tag_to_search = customer_dummy_info.tags.find(tag => tag.key === 'customer_id');
    if (!tag_to_search) {
      context.log(`Tag customer_id not found for dummy device ${}`);

    // Check if there is any device with tag key "customer_id" with the value of the tag on the customer device.
    const devices_to_copy =  await account.devices.list({ fields: ['id', 'name', 'tags'], filter: { tags: [{ key: 'customer_id', value: tag_to_search.value }] } });
    if (!devices_to_copy.length) {
      context.log(`No device found for customer_id ${tag_to_search.value}`);

    // Get the dummy device token and instance device class.
    const dummy_device_token = await Utils.getTokenByName(account,;
    const dummy_device = new Device({ token: dummy_device_token });

    // Send each device to the function copyToDummyDevice.
    devices_to_copy.forEach((device) => {
      copyToDummyDevice(account, dummy_device,;

module.exports = new Analysis(startAnalysis);


my analysis is stopping in dummy_device_token line, only stop, not showing any error.

Can you help me?

More details about the error in here: API request limitations

Hi @julihermes.melo

Welcome to our community! We’re glad to have you here. :partying_face:

We will be offering assistance to you here: API request limitations

Best regards!

Phil Gutierre
Customer Support

1 Like

Thanks, I’ll wait there then!