Question

Html to link to custom explore?

  • 3 July 2018
  • 1 reply
  • 221 views

Hello,



I have a measure that I want to link out to an explore with custom filter settings. We have a dev and prod environment setup for our use case. I elected to use something like this:


measure: sum_count_tickets { html: <a href="https://analytics.dev.info/explore/...">{{value}}</a> ;; }


From the html docs, I haven’t seen any way to dynamically set the analytics.dev.info portion based on the environment I am using this. Any suggestions here?


1 reply

Userlevel 2

Hey @ajhong91 ,



You should be able to achieve this with user attributes and liquid. The steps are:





  • create user attributes called “domain” in both instances and assign them different default values


  • build the link in sections by prepending the protocol to the domain and appending the resource path to the protocol/resource path


  • finish up by appending the fields and filters in the href attribute




dimension: zip {

type: zipcode

sql: ${TABLE}.zip ;;

html:

{% assign dynamic_domain = _user_attributes['domain'] | prepend: "https://" | append: "/explore/ecom/users_new" %}

<a href="{{ dynamic_domain }}?fields=users_new.city&f[users_new.city]={{ _filters['users_new.city'] | url_encode }}" >{{value}}</a> ;;

}



Thanks,


Philip

Reply