# Implementation
## Code setup
The code below should be added into the ```<head>``` section, just after ```</title>```, on all pages.
In principal there are two types of snippets: Basic and Advanced. The difference is that advanced snippet includes information about the user that is sent from backend.
### Basic snippet
As mentioned before, install the following code all the way up in the head tag. If all the way up is not possible, install it at least before google analytics tag.
**The snippet has to be placed below Google Analytics snippet!**
```javascript=
<!-- begin Convert Experiences code-->
<script type="text/javascript" src="//cdn-4.convertexperiments.com/js/10042745-10043626.js"></script>
<!-- end Convert Experiences code -->
```
### Advanced snippet
In addition, as you can see there is a possibility to use custom variables. These should be filled in for better targetting during experiments. Lets go through them one by one with some examples:
- ```_conv_page_type``` - this is simply a page type for example: category, listing, product, cart, checkout ...
- ```_conv_category_id``` - if you have categories on your website, you can place here the category ID and use that in the targeting options; This is again a string of maximum 50 characters;
- ```_conv_category_name``` - same as category ID only that this one is used for category name;
- ```_conv_product_name``` - same as product SKU but used for product names;
For now it makes sense to define the above 4 variables on the page. When a proper usecase appears we could define more. Therefore in the code block below the variables that are commented out should not be used.
For more information on setting up custom variables please visit [this resource](https://support.convert.com/hc/en-us/articles/205152665-Targeting-with-Advanced-Page-Tagging).
```javascript
<!--begin Convert Experiences code-->
<script type="text/javascript">
// fill in the values for the variables that you want to use
var _conv_page_type = "Opleidingspagina";
var _conv_category_id = "pmc-51";
var _conv_category_name = "Onderwijs & Kinderopvang";
//var _conv_product_sku = "";
var _conv_product_name = "Leraar­ondersteuner onderwijs";
//var _conv_product_price = "";
//var _conv_customer_id = "";
//var _conv_custom_v1 = "";
//var _conv_custom_v2 = "";
//var _conv_custom_v3 = "";
//var _conv_custom_v4 = "";
<!--end of editing here-->
</script>
<script type="text/javascript" src="//cdn-4.convertexperiments.com/js/10042745-10043626.js"></script>
<!-- end Convert Experiences code -->
```
The information can be taken from the dataLayer that is currently implemented on website.

## GDPR and Privacy
Al a rule of thumb we advice placing experiment platform cookies or skript behind the analytic wall. When a user accept analytics cookies, either allow experiment cookies or enable the script to run on the page. The type of cookie as well as their naming and structure can be found [here](https://support.convert.com/hc/en-us/articles/204495429-Convert-Experiences-Tracking-Cookies-Structure.)
# Integrations
## GA4
For integrating Convert to report with Google Analytics 4, we would need to follow [this guide](https://support.convert.com/hc/en-us/articles/15577127776141-Integrate-Convert-Experiences-with-Google-Analytics-4).