Endara ƙa'idar Gangamin Nazarin Google Querystring Dynamically using jQuery

jquery

Aboki Bakano aiko min da bayani ta hanyar Twitter don matsalar da ban sami damar samar da mafita ba. Tunda a wasu lokuta ana daukar bakunanmu akan Compendium akan wani yanki na biyu don abokin ciniki, muna so mu wuce Lambar kamfen ɗin Google Analytics zuwa yankin farko don su iya bin diddigin baƙi yadda yakamata.

Wata matsala, kodayake, shine tabbatar masu rubutun ra'ayin yanar gizonku koyaushe sun haɗa da lambar kamfen… wani abu da bai kamata a tsammaci ba. Maganin daidai shine yi amfani da JavaScript don ƙara haɓaka lambar kamfen ɗin lokacin da shafi yayi lodi.

daftarin aiki. riga (aiki () {
var campaignQueryString = '? {cika wannan a cikin}';
var targetDomain = '{cika wannan a ciki' ';
$ ("a [href = 'http: // www." + targetDomain + "]'"). kowanne (aiki () {
wannan.href + = kamfenQueryString;
});
});

Wannan takamaiman bayani yana amfani kuma yana buƙatar jQuery, tushen buɗe JavaScript tsarin. Ina babban fan na jQuery don ƙara wasu kyawawan sakamako ga shafukan yanar gizo . Na ji ra'ayoyin cewa wasu masu haɓaka masana'antun ba sa godiya ga ƙoƙarin ci gaba da fassarar, kodayake.

Idan kayi amfani da lambar da ke sama, dole ne ku haɗa da jQuery. Ina ba da shawarar ɗora shi daga Google. Tunda mutane da yawa suna yin wannan, shafinku zai ɗora da sauri sosai tunda lambar ta ɓoye, kasancewar an ɗora ta a baya.


Google har ma yana samar da wani URL Mai Gina don nuna maka yadda zaka gina kamfen ɗin ka. Idan kuna son samun kyakkyawa, Ina ba da shawarar ƙarawa a cikin abubuwa kamar kalmomin shiga, rukuni, marubuta, da dai sauransu.

daya comment

  1. 1

Me kuke tunani?

Wannan shafin yana amfani da Akismet don rage spam. Koyi yadda aka sarrafa bayanan bayaninka.