Answer the question
In order to leave comments, you need to log in
How to set google analytics goals using js?
Please tell me, I want to set a goal for the feedback form.
There is no possibility to add onsubmit to the input, I'm trying to implement it using js, but the goal does not work. The structure looks like this:
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery('.fc_form').attr("onsubmit","gtag('send', 'event', { 'event_category': 'sub', 'event_action': 'btnsub'}); return true;");
});
</script>
Answer the question
In order to leave comments, you need to log in
Always check the goal setting in the following order:
1. See if the goal is working. If not, then
2. See if events arrive in GA in real time. If not, then
3. Check if the code works. You can write console.log('1') in the code and test
it. And then you can already understand where the problem is and look for ways to solve it. It's still not clear what exactly isn't working for you.
@sochi-russia
do. if you don't know how, learn. If you don't want to learn, hire a professional.
to explain how to work with the database from php is clearly beyond the scope of the question on the toaster.
material in the sea network.
php.net/manual/ru/intro.mysqli.php
www.mysql.ru/docs/man/Reference.html
I'll probably sum up all the previous answers:
1. You need to use some kind of storage on your server to write data to it and give it to the user from it.
2. The data in the storage will be synchronized with the API once every N units of time.
3. The storage can be:
3.1 Relational Database, such as Mysql.
3.2 Non-relational Database such as Redis.
3.3 Local cache.
If now you don’t understand anything or don’t know how to implement it, click here And yes, there are NO
other SIMPLE options . You can’t just take and speed up what you want.
Write data from api to database every n minutes in cron.
Well, if you have an immense fear of using a database in your symptoms, I would somehow store the cache like this:
$recivedDataArray = array(....); //То что с АПИ получили
$toCache = serialize($recivedDataArray);
file_put_contents ("cache/".time()."_cache", $toCache);
file_put_contents ("cache/last_cache", $toCache);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question