ट्रैकर ऑब्जेक्ट रेफ़रंस

यह रेफ़रंस, Tracker ऑब्जेक्ट पर उपलब्ध तरीकों के बारे में बताता है.

तरीके की खास जानकारी

तरीके
get(fieldName)

लौटाए जाने वाले प्रॉडक्ट: *

ट्रैकर पर सेव किए गए फ़ील्ड की वैल्यू का पता लगाता है.

set(fieldName|fieldsObject, [fieldValue])

लौटाए जाने वाले प्रॉडक्ट: undefined

ट्रैकर पर फ़ील्ड/वैल्यू पेयर या फ़ील्ड/वैल्यू पेयर का ग्रुप सेट करता है.

send([hitType], [...fields], [fieldsObject])

लौटाए जाने वाले प्रॉडक्ट: undefined

Google Analytics को हिट भेजता है.

तरीकों की जानकारी

get

ट्रैकर पर सेव किए गए फ़ील्ड की वैल्यू का पता लगाता है.

इस्तेमाल का तरीका

tracker.get(fieldName);

पैरामीटर

नाम टाइप ज़रूरी है ब्यौरा
fieldName string हाँ उस फ़ील्ड का नाम जिसकी वैल्यू जिस पर है.

लौटाए गए प्रॉडक्ट

*

उदाहरण

// Creates a default tracker.
ga('create', 'UA-XXXXX-Y', auto);

// Gets the client ID of the default tracker and logs it.
ga(function(tracker) {
  var clientId = tracker.get('clientId');
  console.log(clientId);
});

set

ट्रैकर पर फ़ील्ड/वैल्यू पेयर या फ़ील्ड/वैल्यू पेयर का ग्रुप सेट करता है.

इस्तेमाल का तरीका

// Sets a single field/value pair.
tracker.set(fieldName, fieldValue);
// Sets a group of field/value pairs.
tracker.set(fieldsObject);

पैरामीटर

अलग-अलग फ़ील्ड के दस्तावेज़ के लिए, फ़ील्ड रेफ़रंस देखें.

लौटाए गए प्रॉडक्ट

undefined

उदाहरण

// Creates a default tracker.
ga('create', 'UA-XXXXX-Y', auto);

ga(function(tracker) {
  // Sets the page field to "/about.html".
  tracker.set('page', '/about.html');
});
// Creates a default tracker.
ga('create', 'UA-XXXXX-Y', auto);

ga(function(tracker) {
  // Sets both the page and title fields.
  tracker.set({
    page: '/about.html',
    title: 'About'
  });
});

send

Google Analytics को हिट भेजता है.

इस्तेमाल का तरीका

tracker.send([hitType], [...fields], [fieldsObject]);

भेजे गए फ़ील्ड, ...fields पैरामीटर और fieldsObject में दी गई वैल्यू होती हैं. इन्हें ट्रैकर में सेव किए गए फ़ील्ड के साथ मर्ज किया जाता है.

पैरामीटर

...fields पैरामीटर से तय किए जा सकने वाले फ़ील्ड, हिट टाइप के आधार पर अलग-अलग होते हैं. नीचे दी गई टेबल में, हर हिट टाइप से जुड़े फ़ील्ड की सूची दी गई है. सूची में नहीं दिए गए हिट टाइप ...fields पैरामीटर को स्वीकार नहीं करते हैं. सिर्फ़ fieldsObject को स्वीकार किया जाता है.

हिट टाइप ...fields
pageview page
event eventCategory, eventAction, eventLabel, eventValue
social socialNetwork, socialAction, socialTarget
timing timingCategory, timingVar, timingValue, timingLabel

अलग-अलग फ़ील्ड के दस्तावेज़ के लिए, फ़ील्ड रेफ़रंस देखें.

लौटाए गए प्रॉडक्ट

undefined

उदाहरण

// Creates a default tracker.
ga('create', 'UA-XXXXX-Y', auto);

ga(function(tracker) {
  // Sends a pageview hit.
  tracker.send('pageview');
});
// Creates a default tracker.
ga('create', 'UA-XXXXX-Y', auto);

ga(function(tracker) {
  // Sends an event hit for the tracker named "myTracker" with the
  // following category, action, and label, and sets the nonInteraction
  // field value to true.
  tracker.send('event', 'link', 'click', 'http://example.com', {
    nonInteraction: true
  });
});