Description
Prerequisites
To use script, you should:
- Have basic knowledge in Python
- Create an account on the freemium tool Plot.ly
- Have on your computer the Python notebook software Jupyter
- Install the Plot.ly package on your computer
API URL creation
The script works with AT Internet’s API URL. Your API call must contain at least the following dimensions and metrics:
1 2 3 |
columns={d_time_date,d_device_type,d_visit_id,d_date_hour_event,d_page,m_page_loads} |
Where the sort parameter is set on the Date-Time (event) (time) dimension:
1 2 3 |
sort={d_date_hour_event} |
Then, you can add filters or segments and choose a specific level.
You can also configure your API URL call with Data Query. For a quick start, you can import the following API URL using the import button in top left-hand side corner of the interface:
1 2 3 |
https://apirest.atinternet-solutions.com/data/v2/json/getData?&columns={d_time_date,d_device_type,d_visit_id,d_date_hour_event,d_page,m_page_loads}&sort={d_date_hour_event}&space={s:YOUR_LEVEL1_ID}&period={R:{D:'-1'}}&max-results=50&page-num=1 |
Tip: The shorter the number of results your data set returns is, the faster the script will be. Therefore, we recommend that you to add filters on the page dimension based on the page labels you wish to see in your funnel analysis.
Script set up
Once that is done, you have to add some extra information as shown in the example below:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
start_date = "2017-11-01" #from... end_date = "2017-11-30" #to... params_api = "columns={d_time_date,d_device_type,d_visit_id,d_date_hour_event,d_page,m_page_loads}&sort={d_date_hour_event}&space={s:123456}}" #Should contain the parameters: columns, sort, filter, segment and space settings. auth = ('login','password') #Your AT Internet login and password. language = 'fr' #'fr' or 'en'. pages = ['landing_page::new_offer','products::details_product','funnel::basket','funnel::order'] #Exact page names in your tunnel in the right chronological order. pages_short_name = ['Landing page', 'product details', 'basket', 'Order'] #Short name of your pages. username_plotly = 'your_un' #Your plotly username. apikey_plotly = "YouRkEy" #Your plotly API Key (https://community.plot.ly/t/how-could-i-get-my-api-key/3088). |
Here is what you have to set:
- start_date: Start date of your analysis period (YYYY-MM-DD)
- end_date: End date of your analysis period (YYYY-MM-DD)
- params_api: Should only contain your API settings, which includes the parameters: columns, sort, filter, segment and space.
- auth: Your AT Internet login et password
- language: Language of your AT Internet account
- pages: The exact page names that will be part of your funnel. They must be in the right order (‘step 1’, ‘step 2’,’step 3’…)
- pages_short_name: The short names of your pages (will be used in funnel visualisation)
- username_plotly: Your plot.ly username
- apikey_plotly: Your plot.ly API Key
Done! You can now launch all your scripts and get visualisations.
Nicolas Hinternesch –
Very cool plugin.
Easy to implement, nifty visualizations, and the integration with Plotly comes in really handy when it comes to deploying / embedding / sharing the visualizations. Fantastic!