Simple all In One Google Ads/Analytics, Yandex Direct/Mertrika, Facebook Ads Pixel tracker
-
Put the "conversionTracker.js" in yor site folder.
-
Add some class to any buttons, links, or items on the page. For example:
<button class="firstButton">
First Button
</button>
<button class="secondButton">
Second Button
</button>
-
For all classes that you added, you need to call function ConversionTracker() each time. The first parameter of the function is the button class, the second parameter is the name of the conversion.
-
Add this code before
</body>
tag
<script src="./conversionTracker.js"></script>
<script>
conversionTracker('firstButton', 'nameOfConversion')
conversionTracker('secondButton', 'nameOfConversion2')
</script>
-
In 'conversionTracker.js' delete any network thay you do not need. If you use Yandex, than you need to insert your account code into it.
-
Last step is to add conversions in analytics:
Google Analytics: Administrator => Goals => New Goal => Own => Type any title and choose Event => Type in "Category" & in "Action" name of your conversion. Example: nameOfConversion
Yandex Metrica: Settings => Goals => Add Goal => JavaScript Event => In "Goal ID" type name of your conversion